From 3e031b4243b38c3739936ae143acf21d305cd570 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 17 Jan 2008 19:58:03 +0000 Subject: [PATCH] Fixed: locked users should not receive email notifications. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1075 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 6 +++--- app/models/message_observer.rb | 2 +- vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 419c6cdc7..a1c46cadf 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -190,9 +190,9 @@ class Issue < ActiveRecord::Base # Returns the mail adresses of users that should be notified for the issue def recipients recipients = project.recipients - # Author and assignee are always notified - recipients << author.mail if author - recipients << assigned_to.mail if assigned_to + # Author and assignee are always notified unless they have been locked + recipients << author.mail if author && author.active? + recipients << assigned_to.mail if assigned_to && assigned_to.active? recipients.compact.uniq end diff --git a/app/models/message_observer.rb b/app/models/message_observer.rb index 1c311e25f..c26805c1b 100644 --- a/app/models/message_observer.rb +++ b/app/models/message_observer.rb @@ -18,7 +18,7 @@ class MessageObserver < ActiveRecord::Observer def after_create(message) # send notification to the authors of the thread - recipients = ([message.root] + message.root.children).collect {|m| m.author.mail if m.author} + recipients = ([message.root] + message.root.children).collect {|m| m.author.mail if m.author && m.author.active?} # send notification to the board watchers recipients += message.board.watcher_recipients recipients = recipients.compact.uniq diff --git a/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb b/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb index c789017e5..53e4455cf 100644 --- a/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb +++ b/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb @@ -37,7 +37,7 @@ module Redmine end def watcher_recipients - self.watchers.collect { |w| w.user.mail } + self.watchers.collect { |w| w.user.mail if w.user.active? }.compact end module ClassMethods -- 2.39.5