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
path: root/config
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-08-03 13:58:00 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-08-03 13:58:00 +0300
commit98e9f52cf4e02562055f9106a155184e7b55012f (patch)
treeba2b9b0deeb3fb3ff92bb844ae67cc6edb8251a2 /config
parent5bbd3a93e963addfa2f1bbfa96c6a3c231e66d09 (diff)
Improve blocked user tracking code readability
Diffstat (limited to 'config')
-rw-r--r--config/initializers/warden.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/config/initializers/warden.rb b/config/initializers/warden.rb
index c06cedf473d..632fdc59dd1 100644
--- a/config/initializers/warden.rb
+++ b/config/initializers/warden.rb
@@ -40,7 +40,12 @@ Rails.application.configure do |config|
# multiple times during the request lifecycle. We want to increment
# metrics and write logs only once in that case.
#
- next if (auth.env['warden.auth.trackers'] ||= {}).push(activity).many?
+ # 'warden.auth.trackers' is our custom hash key that follows usual
+ # convention of naming keys in the Rack env hash. If there is more
+ # than one tracker in the hash it means that we have already recorded
+ # an event.
+ #
+ next if (auth.env['warden.auth.trackers'] ||= []).push(activity).many?
if user.blocked?
activity.user_blocked!