summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2019-04-24 17:50:00 +0700
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2019-05-02 12:28:26 +0700
commit5faa98f481e0f5e0ccb1758c34a104f523ab21d2 (patch)
tree3119efc05e2ecc91cc0d91217c0869b69f656ea6 /app
parent0f863c68bb8bc5054a22e0c553a933c83bea4df6 (diff)
downloadgitlab-ce-5faa98f481e0f5e0ccb1758c34a104f523ab21d2.tar.gz
Session stored globally per requestjej/session-stored-globaly
- This can be accessed with Session.current and is restored after. - Data can be stored under a key with NamespacedSessionStore
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index ceaa84acaba..4cbab6811bc 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -27,6 +27,7 @@ class ApplicationController < ActionController::Base
before_action :check_impersonation_availability
around_action :set_locale
+ around_action :set_session_storage
after_action :set_page_title_header, if: :json_request?
after_action :limit_unauthenticated_session_times
@@ -434,6 +435,10 @@ class ApplicationController < ActionController::Base
Gitlab::I18n.with_user_locale(current_user, &block)
end
+ def set_session_storage(&block)
+ Gitlab::Session.with_session(session, &block)
+ end
+
def set_page_title_header
# Per https://tools.ietf.org/html/rfc5987, headers need to be ISO-8859-1, not UTF-8
response.headers['Page-Title'] = URI.escape(page_title('GitLab'))