修改《讨论吧发帖发送邮件错误问题》

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2015-02-02 11:00:23 +08:00
parent 78d8a0a1c6
commit 858b5ea97c
4 changed files with 12 additions and 9 deletions

View File

@ -23,7 +23,7 @@ class Forum < ActiveRecord::Base
acts_as_taggable
scope :by_join_date, order("created_at DESC")
after_create :send_email
#after_create :send_email
def reset_counters!
self.class.reset_counters!(id)
end

View File

@ -50,10 +50,15 @@ class Mailer < ActionMailer::Base
@forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id)
@issue_author_url = url_for(user_activities_url(@author))
recipients ||= []
mems = memo.self_and_siblings
mems.each do |mem|
recipients << mem.author.mail unless recipients.include? mem.author.mail
if !memo.parent_id.nil?
mems = memo.self_and_siblings
mems.each do |mem|
recipients << mem.author.mail unless recipients.include? mem.author.mail
end
else
recipients << memo.author.mail
end
recipients << @author.mail unless recipients.include? @author.mail
# cc = wiki_content.page.wiki.watcher_recipients - recipients
@memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)))
@ -98,10 +103,7 @@ class Mailer < ActionMailer::Base
#收件人邮箱
@recipients ||= []
@members.each do |teacher|
@recipients << teacher.user.mail
end
mail :to => @recipients,
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} "

View File

@ -47,7 +47,7 @@ class Memo < ActiveRecord::Base
"parent_id",
"replies_count"
after_create :add_author_as_watcher, :reset_counters!, :sendmail#,:be_user_score -- 公共区发帖暂不计入得分
after_create :add_author_as_watcher, :reset_counters! #, :sendmail#,:be_user_score -- 公共区发帖暂不计入得分
# after_update :update_memos_forum
after_destroy :reset_counters!#,:down_user_score -- 公共区发帖暂不计入得分
# after_create :send_notification

View File

@ -39,7 +39,8 @@ module RedmineApp
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
config.active_record.observers = :journals_for_message_observer, :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer, :wiki_content_observer, :comment_observer
config.active_record.observers = :journals_for_message_observer, :message_observer, :issue_observer, :journal_observer, :news_observer,
:document_observer, :wiki_content_observer, :comment_observer, :forum_observer, :memo_observer
config.active_record.store_full_sti_class = true
config.active_record.default_timezone = :local