Skip to content

Instantly share code, notes, and snippets.

@sigismund
Last active February 6, 2022 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sigismund/bbabd145b8a21b781de050805a31215f to your computer and use it in GitHub Desktop.
Save sigismund/bbabd145b8a21b781de050805a31215f to your computer and use it in GitHub Desktop.
Jira - remove watched but completed issues
AJS.$.ajax({
url: '/rest/api/latest/search',
data: {jql:'watcher = currentUser() AND status in (Done, Deployed, Closed)'},
success: function (response) {
AJS.$.each(response.issues, function(i,issue) {
var completed = ['Done', 'Deployed', 'Closed']
if (completed.includes(issue.fields.status.name)) {
AJS.$.ajax({
url: '/rest/api/1.0/issues/' + issue.id + '/watchers',
type: 'delete',
success: function () { console.log('Unwatched ' + issue.key); }
});
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment