|
|
@ -25,8 +25,11 @@ class ForgeActivity < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
|
|
# 在个人动态里面增加当前动态
|
|
|
|
# 在个人动态里面增加当前动态
|
|
|
|
# 版本库提交动态不显示在用户动态中
|
|
|
|
# 版本库提交动态不显示在用户动态中
|
|
|
|
|
|
|
|
# Commit为版本库提交类型,因为是从gitlab获取,不能实时更新
|
|
|
|
def add_user_activity
|
|
|
|
def add_user_activity
|
|
|
|
if self.forge_act_type != "Changeset"
|
|
|
|
if self.forge_act_type == "Commit"
|
|
|
|
|
|
|
|
self.update_column(:updated_at, self.forge_act.committed_on)
|
|
|
|
|
|
|
|
else
|
|
|
|
user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'").first
|
|
|
|
user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'").first
|
|
|
|
if user_activity
|
|
|
|
if user_activity
|
|
|
|
user_activity.save
|
|
|
|
user_activity.save
|
|
|
@ -50,7 +53,9 @@ class ForgeActivity < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
|
|
# 项目提交动态不显示在组织动态中
|
|
|
|
# 项目提交动态不显示在组织动态中
|
|
|
|
def add_org_activity
|
|
|
|
def add_org_activity
|
|
|
|
if self.forge_act_type != "Changeset"
|
|
|
|
if self.forge_act_type == "Commit"
|
|
|
|
|
|
|
|
self.update_column(:updated_at, self.forge_act.committed_on)
|
|
|
|
|
|
|
|
else
|
|
|
|
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 = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
|
|
|
|
if org_activity
|
|
|
|
if org_activity
|
|
|
|
org_activity.updated_at = self.updated_at
|
|
|
|
org_activity.updated_at = self.updated_at
|
|
|
|