Feature #38238
closed
Auto watch issues on issue creation
Added by Felix Schäfer almost 2 years ago.
Updated over 1 year ago.
Category:
Email notifications
Description
Similar to #4347 we propose adding an option to watch issues the user created. This would allow users to more finely control which issues they want to be notified about rather than having to select the "only owner" or "only my events" and receiving notifications for all the issues the user created. This will also allow in the future to replace the mail notification options with only having auto watching options.
Files
The attached patch adds a new option to auto watch issues the user creates. This option is activated for users that already have the issues contributed to auto watch option active.
Please note there is also a typo in the journal tests:
diff --git a/test/unit/journal_test.rb b/test/unit/journal_test.rb
index 511b164153..2368f79656 100644
--- a/test/unit/journal_test.rb
+++ b/test/unit/journal_test.rb
@@ -120,7 +120,7 @@ class JournalTest < ActiveSupport::TestCase
end
end
- def test_create_should_add_wacher
+ def test_create_should_add_watcher
user = User.first
user.pref.auto_watch_on=['issue_contributed_to']
user.save
- Target version set to Candidate for next major release
- Related to Feature #4347: Contributing to an issue should automatically add the user to the watchers list added
We have noticed an issue when this option is activated and the author adds themself as a watcher to the new issue when creating it. This updated patch adds a test for this case and fixes this issue.
I am sorry for the trouble but we have noticed a lot of issues with the callback structure in the proposed patch. We have reworked the feature to use a after_create_commit
callback so that the issue is already saved when the automatic watcher is added and top avoid the issue not getting saved because of errors in the callbacks. Adding automatic watchers is not a core feature of issues and thus should not block creating the issue.
I will post an updated patch shortly.
Please see the updated attached patch. As previously summarised this removes adding the automatic watcher from the issue transaction so that this does not interfere with creating the issue.
We have also added a patch to never auto watch for the anonymous user. Due to the anonymous getting new UserPreference
each time the anonymous user is used the default UserPreference
will be used, which includes auto watching new issues and issue edits. This should be fixed with a better UserPreference
for the anonymous user, but this is outside the scope of this issue.
- Target version changed from Candidate for next major release to 5.1.0
Setting the target version to 5.1.0.
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patches. Thank you for your contribution.
- Related to Feature #38343: Change the default notification option to "Only for things I watch or I am assigned to" added
Also available in: Atom
PDF