Add user option to auto-watch issues previously assigned to me (#2716).

git-svn-id: https://svn.redmine.org/redmine/trunk@24312 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2026-01-14 06:56:34 +00:00
parent f492f7a0b7
commit 2d8ccf778d
3 changed files with 10 additions and 1 deletions

View File

@@ -354,6 +354,14 @@ class Journal < ApplicationRecord
!Watcher.any_watched?(Array.wrap(journalized), user)
journalized.set_watcher(user, true)
end
assignee = journalized.assigned_to
if assignee.is_a?(User) && assignee&.active? &&
assignee.allowed_to?(:add_issue_watchers, project) &&
assignee.pref.auto_watch_on?('issue_assigned_to_me') &&
!Watcher.any_watched?(Array.wrap(journalized), assignee)
journalized.set_watcher(assignee, true)
end
end
def send_notification

View File

@@ -44,7 +44,7 @@ class UserPreference < ApplicationRecord
TEXTAREA_FONT_OPTIONS = ['monospace', 'proportional']
DEFAULT_TOOLBAR_LANGUAGE_OPTIONS = %w[c cpp csharp css diff go groovy html java javascript objc perl php python r ruby sass scala shell sql swift xml yaml]
AUTO_WATCH_ON_OPTIONS = %w[issue_created issue_contributed_to]
AUTO_WATCH_ON_OPTIONS = %w[issue_created issue_contributed_to issue_assigned_to_me]
def initialize(attributes=nil, *args)
super

View File

@@ -996,6 +996,7 @@ en:
label_auto_watch_on: Auto watch
label_auto_watch_on_issue_created: Issues I created
label_auto_watch_on_issue_contributed_to: Issues I contributed to
label_auto_watch_on_issue_assigned_to_me: Issues assigned to me
label_preferences: Preferences
label_chronological_order: In chronological order
label_reverse_chronological_order: In reverse chronological order