From 858b5ea97c2bb896d09c515003b2d406381b90a2 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 2 Feb 2015 11:00:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=90=A7=E5=8F=91=E5=B8=96=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=E3=80=8B=20Signed-off-by:?= =?UTF-8?q?=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/forum.rb | 2 +- app/models/mailer.rb | 14 ++++++++------ app/models/memo.rb | 2 +- config/application.rb | 3 ++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/models/forum.rb b/app/models/forum.rb index e47d18b02..baa8e6260 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -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 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index f42c20acc..ffd5e87be 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -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)} " diff --git a/app/models/memo.rb b/app/models/memo.rb index 165f8e144..7d463c28b 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -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 diff --git a/config/application.rb b/config/application.rb index c7f2f3ea5..000250a61 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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