提交后更新项目动态表update时间
This commit is contained in:
parent
472eb4736e
commit
466a25c121
|
@ -25,8 +25,11 @@ class ForgeActivity < ActiveRecord::Base
|
|||
|
||||
# 在个人动态里面增加当前动态
|
||||
# 版本库提交动态不显示在用户动态中
|
||||
# Commit为版本库提交类型,因为是从gitlab获取,不能实时更新
|
||||
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
|
||||
if user_activity
|
||||
user_activity.save
|
||||
|
@ -50,7 +53,9 @@ class ForgeActivity < ActiveRecord::Base
|
|||
|
||||
# 项目提交动态不显示在组织动态中
|
||||
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
|
||||
if org_activity
|
||||
org_activity.updated_at = self.updated_at
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace :gitlab do
|
|||
commits = g.commits(project.gpid, :ref_name => g_default_branch, :page => page)
|
||||
commits.each do |commit|
|
||||
result = Commit.create(:project_id => project.id, :repository_id => project.gpid, :version => commit.id, :committer => commit.author_email, :comments => Redmine::CodesetUtil.to_utf8(commit.title, 'UTF-8'), :committed_on => commit.created_at)
|
||||
puts "result is #{result}"
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
|
|
Loading…
Reference in New Issue