-
Bug
-
Resolution: Unresolved
-
Low (View bug fix roadmap)
-
None
-
7.0.10, 7.2.0, 7.3.0, 7.4.0, 7.0.0, 7.8.0, 7.10.2
-
7
-
19
-
7
-
Summary
If using a post-function that mutates watchers, it can cause the watcher counts to get out of sync. This leads to being unable to remove watchers unless there is more than 1 watcher on the issue.
Steps to Reproduce
- Install the JIRA Workflow Toolbox add-on.
- Configure it to add watchers no issue transition.
- Add a watcher normally.
- Transition an issue and add a watcher during that transition.
- Attempt to remove both watchers.
Expected Results
Both watchers can be removed.
Actual Results
Only one can be (the first one). If there's only one left it can't be.
Notes
This is not caused by the plugin as it uses our API - the problem is when the API is called during transition:
- In com.atlassian.jira.issue.watchers.DefaultWatcherManager#adjustWatchCount (this is what the API gets into) it creates a cloned issue and updates the watcher count and persists that. This is fine for com.atlassian.jira.web.action.issue.VoteOrWatchIssue#doExecute because nothing happens after that.
- However in the workflow transition, com.atlassian.jira.workflow.OSWorkflowManager#doWorkflowActionInsideTxn, it's quite different:
try { wf.doAction(wfid, from.getAction(), inputs); // save the issue updates - the generate change history function stores the issue as well, but if it has been modified by some post functions // after that we need to store the issue again. issue.store(); // commit the TX txn.commit();
- The problem is inside the workflow, we perform the watch update, with the updated issue count on jiraissue, however then we store the issue again inside the transition method and it overwrites the change. Doh.
- relates to
-
JRASERVER-35622 Cannot delete watchers from an issue that was imported using the Project Import
-
- Closed
-
- mentioned in
-
Page Failed to load
Hi All, since Atlassian did not fix this bug by now (already 8 years) I decided to develop a soltution for this.
This solution has been tested with listeners but shuold work with post function as well
The Trick is very easy just wrap the watchManager.startWatching(user, issue) into a TimerTask
Using Scriptrunner:
This way I am able to delete the added user manually via GUI
Cheers
Heiko Gerlach
Nexus AG