summaryrefslogtreecommitdiff
path: root/app/models/event.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-05-03 22:44:39 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-05-04 15:36:04 -0300
commit91b5aaf770836b7101414527a4650db5fa669ce2 (patch)
tree1c861dc3427f71da051d72b49f38de046994eed0 /app/models/event.rb
parent56db54d3e53f5bac4aa5190d3189f015e3fdbfa7 (diff)
downloadgitlab-ce-91b5aaf770836b7101414527a4650db5fa669ce2.tar.gz
Update last_repository_updated_at when a push event is created
Diffstat (limited to 'app/models/event.rb')
-rw-r--r--app/models/event.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/event.rb b/app/models/event.rb
index b780c1faf81..e6fad46077a 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -30,6 +30,7 @@ class Event < ActiveRecord::Base
# Callbacks
after_create :reset_project_activity
+ after_create :set_last_repository_updated_at, if: :push?
# Scopes
scope :recent, -> { reorder(id: :desc) }
@@ -357,4 +358,9 @@ class Event < ActiveRecord::Base
def recent_update?
project.last_activity_at > RESET_PROJECT_ACTIVITY_INTERVAL.ago
end
+
+ def set_last_repository_updated_at
+ Project.unscoped.where(id: project_id).
+ update_all(last_repository_updated_at: created_at)
+ end
end