diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-17 21:23:43 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-17 21:23:43 +0300 |
commit | b3a90aba41a040378530cb9f1980497e16bbdb11 (patch) | |
tree | ae8d7db8994ad89a2469eb59280df2b40cca20fd | |
parent | e44e2316c3e223955847859492f6f9bd7974e50e (diff) | |
download | gitlab-ce-b3a90aba41a040378530cb9f1980497e16bbdb11.tar.gz |
Remove ProjectActivityCacheObserver
-rw-r--r-- | app/models/event.rb | 9 | ||||
-rw-r--r-- | app/observers/project_activity_cache_observer.rb | 8 | ||||
-rw-r--r-- | config/application.rb | 3 |
3 files changed, 10 insertions, 10 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index b88635ccb59..92ad70f4eea 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -41,6 +41,9 @@ class Event < ActiveRecord::Base # For Hash only serialize :data + # Callbacks + after_create :reset_project_activity + # Scopes scope :recent, -> { order("created_at DESC") } scope :code_push, -> { where(action: PUSHED) } @@ -303,4 +306,10 @@ class Event < ActiveRecord::Base target.respond_to? :title end end + + def reset_project_activity + if project + project.update_column(:last_activity_at, event.created_at) + end + end end diff --git a/app/observers/project_activity_cache_observer.rb b/app/observers/project_activity_cache_observer.rb deleted file mode 100644 index 96ced90db80..00000000000 --- a/app/observers/project_activity_cache_observer.rb +++ /dev/null @@ -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 - diff --git a/config/application.rb b/config/application.rb index 540426b6672..43fcb4bcf7e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -19,8 +19,7 @@ module Gitlab # config.plugins = [ :exception_notification, :ssl_requirement, :all ] # Activate observers that should always be running. - config.active_record.observers = :project_activity_cache_observer, - :note_observer, + config.active_record.observers = :note_observer, :project_observer, :system_hook_observer, :user_observer, |