diff --git a/lib/gitlab/auth/activity.rb b/lib/gitlab/auth/activity.rb index e09ba2eeabc..d5d1428ba58 100644 --- a/lib/gitlab/auth/activity.rb +++ b/lib/gitlab/auth/activity.rb @@ -32,9 +32,7 @@ module Gitlab self.class.user_password_invalid_counter_increment! end - if @user.present? && @user.blocked? - self.class.user_blocked_counter_increment! - end + self.class.user_blocked_counter_increment! if @user&.blocked? end def user_authenticated! diff --git a/spec/support/prometheus/custom_matchers.rb b/spec/support/matchers/metric_counter_matcher.rb similarity index 100% rename from spec/support/prometheus/custom_matchers.rb rename to spec/support/matchers/metric_counter_matcher.rb