From b20204fedd1846b1609b185fb96e1f3dd85abbb0 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 23 Jan 2015 13:42:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E9=87=8D=E5=8F=91=E4=B8=80=E6=A0=B7=E5=BC=95=E5=8F=91=E7=9A=84?= =?UTF-8?q?bug=E3=80=8B=20Signed-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/issue_observer.rb | 3 ++- app/models/journal_observer.rb | 3 ++- app/models/mailer.rb | 16 +++++----------- app/views/mailer/message_posted.html.erb | 4 ---- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/app/models/issue_observer.rb b/app/models/issue_observer.rb index 50cbf2a42..e404a4a1c 100644 --- a/app/models/issue_observer.rb +++ b/app/models/issue_observer.rb @@ -19,7 +19,8 @@ class IssueObserver < ActiveRecord::Observer def after_create(issue) Thread.start do - recipients = issue.recipients + # 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送, + recipients = issue.recipients - issue.watcher_recipients + issue.watcher_recipients recipients.each do |rec| Mailer.issue_add(issue,rec).deliver if Setting.notified_events.include?('issue_added') end diff --git a/app/models/journal_observer.rb b/app/models/journal_observer.rb index 10d3f7b4b..b58464a9b 100644 --- a/app/models/journal_observer.rb +++ b/app/models/journal_observer.rb @@ -24,7 +24,8 @@ class JournalObserver < ActiveRecord::Observer (Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?) ) Thread.start do - recipients = journal.recipients + # 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送, + recipients = journal.recipients - journal.watcher_recipients + journal.watcher_recipients recipients.each do |rec| Mailer.issue_edit(journal,rec).deliver diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 23ac36054..1760d9004 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -147,13 +147,11 @@ class Mailer < ActionMailer::Base @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value) @user_url = url_for(my_account_url(user,:token => @token.value)) - cc = nil - if recipients == issue.recipients[0] - cc = issue.watcher_recipients - issue.recipients - end + + subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}" mail(:to => recipients, - :cc => cc, + :subject => subject) end # issue.attachments.each do |attach| @@ -198,11 +196,7 @@ class Mailer < ActionMailer::Base - # Watchers in cc - cc = nil - if recipients == journal.recipients[0] - cc = journal.watcher_recipients - journal.recipients - end + s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] " s << "(#{issue.status.name}) " if journal.new_value_for('status_id') @@ -211,7 +205,7 @@ class Mailer < ActionMailer::Base @journal = journal # @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}") mail(:to => recipients, - :cc => cc, + :subject => s) end diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb index e031c2e98..1fe28e04f 100644 --- a/app/views/mailer/message_posted.html.erb +++ b/app/views/mailer/message_posted.html.erb @@ -1,8 +1,4 @@ - - - -
<%= h @message.author %>(<%= @message.author.show_name %>)