diff options
Diffstat (limited to 'app/models/event.rb')
-rw-r--r-- | app/models/event.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index b780c1faf81..46e89388bc1 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -26,10 +26,11 @@ class Event < ActiveRecord::Base belongs_to :target, polymorphic: true # For Hash only - serialize :data + serialize :data # rubocop:disable Cop/ActiverecordSerialize # 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 |