Remove ProjectActivityCacheObserver
This commit is contained in:
parent
e44e2316c3
commit
b3a90aba41
|
@ -41,6 +41,9 @@ class Event < ActiveRecord::Base
|
||||||
# For Hash only
|
# For Hash only
|
||||||
serialize :data
|
serialize :data
|
||||||
|
|
||||||
|
# Callbacks
|
||||||
|
after_create :reset_project_activity
|
||||||
|
|
||||||
# Scopes
|
# Scopes
|
||||||
scope :recent, -> { order("created_at DESC") }
|
scope :recent, -> { order("created_at DESC") }
|
||||||
scope :code_push, -> { where(action: PUSHED) }
|
scope :code_push, -> { where(action: PUSHED) }
|
||||||
|
@ -303,4 +306,10 @@ class Event < ActiveRecord::Base
|
||||||
target.respond_to? :title
|
target.respond_to? :title
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reset_project_activity
|
||||||
|
if project
|
||||||
|
project.update_column(:last_activity_at, event.created_at)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
class ProjectActivityCacheObserver < BaseObserver
|
|
||||||
observe :event
|
|
||||||
|
|
||||||
def after_create(event)
|
|
||||||
event.project.update_column(:last_activity_at, event.created_at) if event.project
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -19,8 +19,7 @@ module Gitlab
|
||||||
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
||||||
|
|
||||||
# Activate observers that should always be running.
|
# Activate observers that should always be running.
|
||||||
config.active_record.observers = :project_activity_cache_observer,
|
config.active_record.observers = :note_observer,
|
||||||
:note_observer,
|
|
||||||
:project_observer,
|
:project_observer,
|
||||||
:system_hook_observer,
|
:system_hook_observer,
|
||||||
:user_observer,
|
:user_observer,
|
||||||
|
|
Loading…
Reference in New Issue