-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
7.3.4, 7.4.0
-
None
-
7.03
-
6
-
Severity 2 - Major
-
2
-
Summary
The watch count can be out of sync due to the autowatch feature when used in conjunction with comments on workflow transitions. Users with autowatch enabled will be added as watchers when transitioning a workflow and commenting in the transition screen, but the count is not update in the jiraissue table
Steps to Reproduce
- Enable autowatch in your user profile if not already enabled
- Transition an issue you are not already a watcher on for a issue with a screen configured for the workflow transition
- Comment on the transition
- Attempt to remove all watchers
Expected Results
All watchers are removed without issue.
Actual Results
All but one watcher is removed, the last watcher you attempt to remove will stay.
Same behaviour as the closed issue JRASERVER-45924.
Query will show 0 watches on jiraissue, but there are watchers in the userassociation table just like in JRASERVER-45924:
To find if an instance is affected, run the following query in the database that returns the amount of issues affected.
select count(*) from (select count(*) as real_watchers_count, i.watches as issue_watches, i.id as issue_id from userassociation a left join jiraissue i on a.sink_node_id = i.id where association_type like 'WatchIssue' group by a.sink_node_id, i.id, i.watches) tt1 where tt1.real_watchers_count > tt1.issue_watches;
To find which specific issues are affected:
select tt1.real_watchers_count, tt1.issue_watches, tt1.issue_id, (p.pkey || '-' || i.issuenum) AS issue, i.summary from jiraissue i inner join project p on i.project = p.id inner join (select count(*) as real_watchers_count, i.watches as issue_watches, i.id as issue_id from userassociation a join jiraissue i on a.sink_node_id = i.id where association_type like 'WatchIssue' group by a.sink_node_id, i.id, i.watches) tt1 on tt1.issue_id = i.id where tt1.real_watchers_count > tt1.issue_watches;
Workaround
For individual issues, you can remove the last watcher by following these steps:
- Add your self as a watcher if you are not already a watcher
- Remove all other watchers
- Click on the number under "watchers" in the People side-panel
- Click the trash icon next to your user watcher (should be the only one)
- Close the watchers list popup
- Click start watching and stop watching until the number is 0 and the link is "start watching this issue"
This query syncs the counts back for all issues:
UPDATE jiraissue i set watches = (select count(*) from userassociation where association_type like 'WatchIssue' and sink_node_id = i.id);
on sites with many thousands of issues, this query may take a long time to complete. Do a DB backup before running.