news.rb回调修改
This commit is contained in:
parent
a309bf4f73
commit
067426824b
|
@ -62,7 +62,7 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message, :delay_news_send
|
||||
after_create :act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message, :delay_news_send
|
||||
after_update :update_activity
|
||||
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
|
||||
|
||||
|
@ -140,19 +140,13 @@ class News < ActiveRecord::Base
|
|||
Watcher.create(:watchable => self, :user => author)
|
||||
end
|
||||
|
||||
## fq
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.author_id)
|
||||
end
|
||||
|
||||
# Time 2015-02-27 15:48:17
|
||||
# Author lizanle
|
||||
# Description 公用表中也要记录
|
||||
def act_as_forge_activity
|
||||
# 如果是project为空,那么是课程相关的,不需要保存
|
||||
if self.project
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
||||
:project_id => self.project.id)
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.project.id)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -198,7 +192,7 @@ class News < ActiveRecord::Base
|
|||
def contain_news_message
|
||||
self.course.members.each do |m|
|
||||
if m.user_id != self.author_id
|
||||
self.course_messages << CourseMessage.new(:user_id => user_id, :course_id => container_id, :viewed => false)
|
||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue