修改当“Message”回复对应的组织动态
This commit is contained in:
parent
5cfc8c2f8d
commit
a57260aae6
|
@ -46,17 +46,28 @@ class ForgeActivity < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def add_org_activity
|
||||
OrgActivity.create(:user_id => self.user_id,
|
||||
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,
|
||||
:org_act_type => self.forge_act_type,
|
||||
:container_id => self.project_id,
|
||||
:container_type => 'Project',
|
||||
:created_at => self.created_at,
|
||||
:updated_at => self.updated_at)
|
||||
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}'")
|
||||
user_activity.destroy_all
|
||||
end
|
||||
|
||||
def destroy_org_activity
|
||||
org_acts = OrgActivity.where("org_act_type='#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'")
|
||||
org_acts.destroy_all
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue