Commit d95d56f0b9b2a321e18bb0f92b008f58e37b20a7
1 parent
ec8d3989
Exists in
spb-stable
and in
2 other branches
Add current_user_id to gon vars
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
app/controllers/application_controller.rb
... | ... | @@ -174,10 +174,14 @@ class ApplicationController < ActionController::Base |
174 | 174 | def add_gon_variables |
175 | 175 | gon.default_issues_tracker = Project.issues_tracker.default_value |
176 | 176 | gon.api_version = API::API.version |
177 | - gon.api_token = current_user.private_token if current_user | |
178 | 177 | gon.gravatar_url = request.ssl? || Gitlab.config.gitlab.https ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url |
179 | 178 | gon.relative_url_root = Gitlab.config.gitlab.relative_url_root |
180 | 179 | gon.gravatar_enabled = Gitlab.config.gravatar.enabled |
180 | + | |
181 | + if current_user | |
182 | + gon.current_user_id = current_user.id | |
183 | + gon.api_token = current_user.private_token | |
184 | + end | |
181 | 185 | end |
182 | 186 | |
183 | 187 | def check_password_expiration | ... | ... |