修改《邮件重发一样引发的bug》

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2015-01-23 13:42:25 +08:00
parent fdba8ca986
commit b20204fedd
4 changed files with 9 additions and 17 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,8 +1,4 @@
<!-- <h1><%#= link_to(h("#{issue.tracker.name} ##{issue.project_index}: #{issue.subject}"), issue_url) %></h1> -->
<p>
<span class="c_blue" style="color:#1b55a7;">
<%= h @message.author %>(<%= @message.author.show_name %>)