Project

General

Profile

Actions

Feature #38238

closed

Auto watch issues on issue creation

Added by Felix Schäfer almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Email notifications
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

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

38238.patch (4.29 KB) 38238.patch Felix Schäfer, 2023-02-03 02:00
38238-2.patch (4.75 KB) 38238-2.patch Felix Schäfer, 2023-02-03 08:11
38238-3_no_anonymous_watcher.patch (2.71 KB) 38238-3_no_anonymous_watcher.patch Felix Schäfer, 2023-02-11 21:42
38238-3.patch (4.51 KB) 38238-3.patch Felix Schäfer, 2023-02-11 21:42

Related issues

Related to Redmine - Feature #4347: Contributing to an issue should automatically add the user to the watchers listClosedMarius BĂLTEANU2009-12-06

Actions
Related to Redmine - Feature #38343: Change the default notification option to "Only for things I watch or I am assigned to"Closed

Actions
Actions #1

Updated by Felix Schäfer almost 2 years ago

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.

Actions #2

Updated by Felix Schäfer almost 2 years ago

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

Actions #3

Updated by Go MAEDA almost 2 years ago

  • Target version set to Candidate for next major release

LGTM!

Actions #4

Updated by Go MAEDA almost 2 years ago

  • Related to Feature #4347: Contributing to an issue should automatically add the user to the watchers list added
Actions #5

Updated by Felix Schäfer almost 2 years ago

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.

Actions #6

Updated by Felix Schäfer almost 2 years ago

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.

Actions #7

Updated by Felix Schäfer almost 2 years ago

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.

Actions #8

Updated by Go MAEDA almost 2 years ago

  • Target version changed from Candidate for next major release to 5.1.0

Setting the target version to 5.1.0.

Actions #9

Updated by Go MAEDA almost 2 years ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patches. Thank you for your contribution.

Actions #10

Updated by Go MAEDA almost 2 years ago

  • Related to Feature #38343: Change the default notification option to "Only for things I watch or I am assigned to" added
Actions

Also available in: Atom PDF