Last active
February 6, 2022 16:37
-
-
Save sigismund/bbabd145b8a21b781de050805a31215f to your computer and use it in GitHub Desktop.
Jira - remove watched but completed issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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