Actions
Patch #44681
openExtract the auto watch logic shared by Issue and Journal into a concern
Description
The rule for automatically adding a user as a watcher of an issue is currently implemented twice:
Issue#add_auto_watcherforissue_createdand, since #44680,issue_assigned_to_meon issue creationJournal#add_watcherandJournal#valid_watcher?forissue_contributed_toandissue_assigned_to_meon issue update
Both copies check the same conditions (the user is active, has the option enabled, has the "Add watchers" permission, can see the issue, and is not already watching it directly or through a group).
The attached patch moves this rule into a newIssue::AutoWatchable concern, following the existing Issue::Webhookable concern:
Issue#auto_watch(user, option)adds the user as a watcher if the given auto watch option is enabled and the user is allowed to watch the issueIssue#add_auto_watcher(creation callback) andJournal#add_watcher(update callback) both call it
Files
Related issues
Updated by Marius BĂLTEANU about 14 hours ago
- Related to Defect #44680: Assignee is not added as a watcher when creating an issue with an assignee who has auto-watch for assigned issues enabled added
Updated by Marius BĂLTEANU about 14 hours ago
- Related to Feature #43673: Allow auto-watching issues assigned to my groups added
Updated by Marius BĂLTEANU about 14 hours ago
- Related to Feature #2716: User option to automatically add assignee to watchers added
Updated by Ivan Kabluchkov about 9 hours ago
I think that checking of permission during "system" actions is not proper way. Because if user has setting auto watch "Issue assigned to me" option and role permission "Add watchers" turned off, than he never be added as watcher to issue. This behaviour can make user confused
The same Florian wrote here https://www.redmine.org/issues/44680#note-1
Actions