Skip to content

Add functionality to delete a watcher from an issue #884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,21 @@ def issue_add_watcher(self, issue_key, user):
data=data,
)

def issue_delete_watcher(self, issue_key, user):
"""
Stop watching issue
:param issue_key:
:param user:
:return:
"""
log.warning('Deleting user {user} from "{issue_key}" watchers'.format(issue_key=issue_key, user=user))
data = user
base_url = self.resource_url("issue")
return self.delete(
"{base_url}/{issue_key}/watchers".format(base_url=base_url, issue_key=issue_key),
data=data,
)

def assign_issue(self, issue, account_id=None):
"""Assign an issue to a user. None will set it to unassigned. -1 will set it to Automatic.
:param issue: the issue ID or key to assign
Expand Down
6 changes: 6 additions & 0 deletions docs/jira.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ Manage issues
# Export Issues to csv
jira.csv(jql, all_fields=False)

# Add watcher to an issue
jira.issue_add_watcher(issue_key, user)

# Remove watcher from an issue
jira.issue_delete_watcher(issue_key, user)


Manage Boards
-------------
Expand Down