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
Actions