diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-08-03 12:58:00 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-08-03 12:58:00 +0200 |
commit | 98e9f52cf4e02562055f9106a155184e7b55012f (patch) | |
tree | ba2b9b0deeb3fb3ff92bb844ae67cc6edb8251a2 /config | |
parent | 5bbd3a93e963addfa2f1bbfa96c6a3c231e66d09 (diff) | |
download | gitlab-ce-98e9f52cf4e02562055f9106a155184e7b55012f.tar.gz |
Improve blocked user tracking code readability
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/warden.rb | 7 |
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! |