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