When using a Post-Function Script to add Watchers we are experiencing the following:
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
I'm seeing this behaviour in Jira 7.13.1 also. My script just adds the assignee as a watcher in a post function.
import com.atlassian.jira.component.ComponentAccessor
def watcherManager = ComponentAccessor.getWatcherManager()
watcherManager.startWatching(issue.assignee, issue)
To stop watching the issue on the UI the user has to:
(a) select "Stop Watching",
(b) select "Start Watching", and then
(c) select "Stop Watching" again.
If they refresh the issue after step (a) then they will be still shown as the watcher.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.