回复项目里的message,不增加项目动态及组织动态
This commit is contained in:
parent
e45ce0fb95
commit
a8b7d1b81f
|
@ -46,12 +46,15 @@ class ForgeActivity < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def add_org_activity
|
||||
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
|
||||
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
|
||||
org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
|
||||
if org_activity
|
||||
org_activity.created_at = self.created_at
|
||||
org_activity.save
|
||||
end
|
||||
else
|
||||
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
|
||||
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
|
||||
org_activity.created_at = self.created_at
|
||||
org_activity.save
|
||||
else
|
||||
OrgActivity.create(:user_id => self.user_id,
|
||||
:org_act_id => self.forge_act_id,
|
||||
|
@ -62,6 +65,7 @@ class ForgeActivity < ActiveRecord::Base
|
|||
:updated_at => self.updated_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_user_activity
|
||||
user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'")
|
||||
|
|
|
@ -186,7 +186,7 @@ class Message < ActiveRecord::Base
|
|||
# Description
|
||||
def act_as_forge_activity
|
||||
# 如果project为空,那么就是课程相关的消息
|
||||
if !self.board.project.nil?
|
||||
if !self.board.project.nil? && self.parent_id.nil?
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
||||
:project_id => self.board.project.id)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue