diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0c31788e..9a0f95bf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,8 +1,12 @@ class ApplicationController < ActionController::Base before_filter :authenticate_user! before_filter :reject_blocked! - before_filter :set_current_user_for_mailer, :check_token_auth + before_filter :set_current_user_for_mailer + before_filter :check_token_auth + before_filter :set_current_user_for_observers + protect_from_forgery + helper_method :abilities, :can? rescue_from Gitlab::Gitolite::AccessDenied do |exception| @@ -58,6 +62,10 @@ class ApplicationController < ActionController::Base MailerObserver.current_user = current_user end + def set_current_user_for_observers + IssueObserver.current_user = current_user + end + def abilities @abilities ||= Six.new end diff --git a/app/models/activity_observer.rb b/app/observers/activity_observer.rb similarity index 100% rename from app/models/activity_observer.rb rename to app/observers/activity_observer.rb diff --git a/app/models/issue_observer.rb b/app/observers/issue_observer.rb similarity index 100% rename from app/models/issue_observer.rb rename to app/observers/issue_observer.rb diff --git a/app/models/key_observer.rb b/app/observers/key_observer.rb similarity index 100% rename from app/models/key_observer.rb rename to app/observers/key_observer.rb diff --git a/app/models/mailer_observer.rb b/app/observers/mailer_observer.rb similarity index 100% rename from app/models/mailer_observer.rb rename to app/observers/mailer_observer.rb diff --git a/app/models/project_observer.rb b/app/observers/project_observer.rb similarity index 100% rename from app/models/project_observer.rb rename to app/observers/project_observer.rb diff --git a/app/models/user_observer.rb b/app/observers/user_observer.rb similarity index 100% rename from app/models/user_observer.rb rename to app/observers/user_observer.rb