When using a Post-Function Script to add Watchers we are experiencing the following:
- Users with Manage Watchers permissions can no longer simply remove any of those Watchers added as part of the Post Function: They must:
(a) delete the user
(b) re-add the user, and
(c) delete the user again within the same "Manage Watchers"
- Users can only remove themselves by:
(a) select "Stop Watching",
(b) select "Start Watching", and then
(c) select "Stop Watching" again.
If the screen is refreshed between either of the above (a) and (b) steps that name is automatically added back as a Watcher.
I did read of other reports about issues with Watchers and Plugins, so not sure it matters, but using the following script:
import com.atlassian.jira.component.ComponentAccessor
def watcherManager = ComponentAccessor.getWatcherManager()
def userManager = ComponentAccessor.getUserManager()
def watchUsers = {usernames ->;
usernames.each {
def user = userManager.getUserByKey(it.toString())
watcherManager.startWatching(user, issue)
}
}
def users = ["user1","user2"]
watchUsers(users)
Environment Adaptavist ScriptRunner v5.3.5 with JIRA v 7.4.4