发送邮件部分代码优化

This commit is contained in:
z9hang 2014-05-29 18:04:21 +08:00
parent c4b292b711
commit 866ae3a38d
1 changed files with 2 additions and 4 deletions

View File

@ -57,6 +57,7 @@ class Mailer < ActionMailer::Base
#如果是直接留言并且留言对象是Project并且Project类型是课程 #如果是直接留言并且留言对象是Project并且Project类型是课程
if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Project && journals_for_message.jour.project_type == 1 if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Project && journals_for_message.jour.project_type == 1
project = journals_for_message.jour project = journals_for_message.jour
@author = journals_for_message.user
#课程的教师 #课程的教师
@teachers = searchTeacherAndAssistant journals_for_message.jour @teachers = searchTeacherAndAssistant journals_for_message.jour
#收件人邮箱 #收件人邮箱
@ -440,10 +441,7 @@ class Mailer < ActionMailer::Base
headers[:to].delete(@author.mail) if headers[:to].is_a?(Array) headers[:to].delete(@author.mail) if headers[:to].is_a?(Array)
headers[:cc].delete(@author.mail) if headers[:cc].is_a?(Array) headers[:cc].delete(@author.mail) if headers[:cc].is_a?(Array)
end end
if !User.current.nil?
#不给本人发邮件
headers[:to].delete(User.current.mail) if headers[:to].is_a?(Array)
end
if @author && @author.logged? if @author && @author.logged?
redmine_headers 'Sender' => @author.login redmine_headers 'Sender' => @author.login
end end