Defect #44680
openAssignee is not added as a watcher when creating an issue with an assignee who has auto-watch for assigned issues enabled
Description
Hello!
Current behaviour functionality of auto watcher is not correct. Watcher doesn't auto setup when issue is created, has assigned user and assignee has preference "Issue assigned to me". But I think assignee should be setup automatically after creation of issue. "Issue assigned to me" option applied only after journalize action (app/models/journal.rb add_watcher)
I've attached the patch with tests.
Files
Related issues
Updated by Florian Walchshofer 1 day ago
I could reproduce this on the current trunk:
when an issue is created with an assignee who has "Issues assigned to me" enabled, the assignee is not added as a watcher. The assignee is only added on the next update of the issue, and only if still assigned. If the first update reassigns the issue, the original assignee is never added and gets no more notifications after the reassignment.
The patch applies cleanly to the trunk, its tests pass, and the assignee is added on creation in both cases.
One remark: all automatic watchers (Issue#add_auto_watcher and Journal#add_watcher, since #4347, #38238 and #2716) require that the user who is added has the permission "Add watchers", while the "Watch" link only requires that the user can see the issue. So a user without this permission can watch an issue by clicking "Watch", but the "Automatically add me as watcher" options do nothing for them.
The patch does not check this permission, which I think is right, but it now differs from the other options. Removing the "Add watchers" check from all automatic watchers, and only checking that the user is active and can see the issue, could be done in a separate issue.
Updated by Marius BĂLTEANU 1 day ago
- Related to Feature #2716: User option to automatically add assignee to watchers added
Updated by Marius BĂLTEANU about 23 hours ago
- Assignee set to Marius BĂLTEANU
- Target version set to 7.0.3
Updated by Marius BĂLTEANU about 23 hours ago
- Status changed from New to Resolved
- Resolution set to Fixed
Patch with additional fixes committed, thanks for reporting and reviewing this issue.
Florian Walchshofer wrote in #note-1:>
One remark: all automatic watchers (
Issue#add_auto_watcherandJournal#add_watcher, since #4347, #38238 and #2716) require that the user who is added has the permission "Add watchers", while the "Watch" link only requires that the user can see the issue. So a user without this permission can watch an issue by clicking "Watch", but the "Automatically add me as watcher" options do nothing for them.
Please open a new issue for this.
Updated by Marius BĂLTEANU about 14 hours ago
- Subject changed from Setup auto watcher after creation of issue to Assignee is not added as a watcher when creating an issue with an assignee who has auto-watch for assigned issues enabled
Updated by Marius BĂLTEANU about 14 hours ago
- Related to Patch #44681: Extract the auto watch logic shared by Issue and Journal into a concern added