OSDN Git Service

Fix IssueObserver current_user assign. Refactored observers
authorrandx <dmitriy.zaporozhets@gmail.com>
Sun, 24 Jun 2012 07:01:42 +0000 (10:01 +0300)
committerrandx <dmitriy.zaporozhets@gmail.com>
Sun, 24 Jun 2012 07:01:42 +0000 (10:01 +0300)
app/controllers/application_controller.rb
app/observers/activity_observer.rb [moved from app/models/activity_observer.rb with 100% similarity]
app/observers/issue_observer.rb [moved from app/models/issue_observer.rb with 100% similarity]
app/observers/key_observer.rb [moved from app/models/key_observer.rb with 100% similarity]
app/observers/mailer_observer.rb [moved from app/models/mailer_observer.rb with 100% similarity]
app/observers/project_observer.rb [moved from app/models/project_observer.rb with 100% similarity]
app/observers/user_observer.rb [moved from app/models/user_observer.rb with 100% similarity]

index 0c31788..9a0f95b 100644 (file)
@@ -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