Fix IssueObserver current_user assign. Refactored observers

This commit is contained in:
randx 2012-06-24 10:01:42 +03:00
parent 55f8338502
commit 6d92aa6d12
7 changed files with 9 additions and 1 deletions

View file

@ -1,8 +1,12 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :reject_blocked! 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 protect_from_forgery
helper_method :abilities, :can? helper_method :abilities, :can?
rescue_from Gitlab::Gitolite::AccessDenied do |exception| rescue_from Gitlab::Gitolite::AccessDenied do |exception|
@ -58,6 +62,10 @@ class ApplicationController < ActionController::Base
MailerObserver.current_user = current_user MailerObserver.current_user = current_user
end end
def set_current_user_for_observers
IssueObserver.current_user = current_user
end
def abilities def abilities
@abilities ||= Six.new @abilities ||= Six.new
end end