Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/namespaced_session_store.rb')
-rw-r--r--lib/gitlab/namespaced_session_store.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/gitlab/namespaced_session_store.rb b/lib/gitlab/namespaced_session_store.rb
index f0f24c081c3..957e8fe9b9f 100644
--- a/lib/gitlab/namespaced_session_store.rb
+++ b/lib/gitlab/namespaced_session_store.rb
@@ -2,10 +2,8 @@
module Gitlab
class NamespacedSessionStore
- delegate :[], :[]=, to: :store
-
def initialize(key, session = Session.current)
- @key = key
+ @namespace_key = key
@session = session
end
@@ -13,11 +11,17 @@ module Gitlab
!session.nil?
end
- def store
+ def [](key)
+ return unless session
+
+ session[@namespace_key]&.fetch(key, nil)
+ end
+
+ def []=(key, value)
return unless session
- session[@key] ||= {}
- session[@key]
+ session[@namespace_key] ||= {}
+ session[@namespace_key][key] = value
end
private