diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-01-22 20:01:05 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-01-22 20:01:05 +0000 |
commit | 91da86a688c27d13c373861901efffc2ec1ddbf1 (patch) | |
tree | 0d1d44f8668661b1657c3f75efae89cdb6ab3e05 /app/models | |
parent | 9110b543b518d2592df583b4fe1d824a0a0871a8 (diff) | |
download | redmine-91da86a688c27d13c373861901efffc2ec1ddbf1.tar.gz redmine-91da86a688c27d13c373861901efffc2ec1ddbf1.zip |
Add watchers from To and Cc fields in issue replies (#7017).
git-svn-id: http://svn.redmine.org/redmine/trunk@15092 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/mail_handler.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 0c3d34c41..dad13ebf8 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -240,6 +240,9 @@ class MailHandler < ActionMailer::Base issue.safe_attributes = issue_attributes_from_keywords(issue) issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)} journal.notes = cleaned_up_text_body + + # add To and Cc as watchers before saving so the watchers can reply to Redmine + add_watchers(issue) add_attachments(issue) issue.save! if logger @@ -314,8 +317,10 @@ class MailHandler < ActionMailer::Base if user.allowed_to?("add_#{obj.class.name.underscore}_watchers".to_sym, obj.project) addresses = [email.to, email.cc].flatten.compact.uniq.collect {|a| a.strip.downcase} unless addresses.empty? - User.active.having_mail(addresses).each do |w| - obj.add_watcher(w) + users = User.active.having_mail(addresses).to_a + users -= obj.watcher_users + users.each do |u| + obj.add_watcher(u) end end end |