Commit 10f14136f570863c2898f429c936de6c0114206a

Authored by Dmitriy Zaporozhets
1 parent bdcaf21e

fix setting gon.api_token

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
app/controllers/application_controller.rb
... ... @@ -152,7 +152,9 @@ class ApplicationController < ActionController::Base
152 152  
153 153 def add_gon_variables
154 154 gon.default_issues_tracker = Project.issues_tracker.default_value
155   - gon.api_token = current_user.private_token
156   - gon.gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url
  155 + if current_user
  156 + gon.api_token = current_user.private_token
  157 + gon.gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url
  158 + end
157 159 end
158 160 end
... ...