Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
98e9f52c
Commit
98e9f52c
authored
Aug 03, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve blocked user tracking code readability
parent
5bbd3a93
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
4 deletions
+8
-4
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+0
-1
config/initializers/warden.rb
config/initializers/warden.rb
+6
-1
lib/gitlab/auth/blocked_user_tracker.rb
lib/gitlab/auth/blocked_user_tracker.rb
+1
-1
spec/lib/gitlab/auth/blocked_user_tracker_spec.rb
spec/lib/gitlab/auth/blocked_user_tracker_spec.rb
+1
-1
No files found.
app/controllers/application_controller.rb
View file @
98e9f52c
...
...
@@ -24,7 +24,6 @@ class ApplicationController < ActionController::Base
before_action
:configure_permitted_parameters
,
if: :devise_controller?
before_action
:require_email
,
unless: :devise_controller?
around_action
:set_locale
after_action
:set_page_title_header
,
if:
->
{
request
.
format
==
:json
}
...
...
config/initializers/warden.rb
View file @
98e9f52c
...
...
@@ -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!
...
...
lib/gitlab/auth/blocked_user_tracker.rb
View file @
98e9f52c
...
...
@@ -19,4 +19,4 @@ module Gitlab
end
end
end
end
\ No newline at end of file
end
spec/lib/gitlab/auth/blocked_user_tracker_spec.rb
View file @
98e9f52c
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
Auth
::
BlockedUserTracker
do
describe
'#log_blocked_user_activity!'
do
context
'when user is not blocked'
do
it
'does not blocked user activity'
do
it
'does not
log
blocked user activity'
do
expect_any_instance_of
(
SystemHooksService
)
.
not_to
receive
(
:execute_hooks_for
)
expect
(
Gitlab
::
AppLogger
).
not_to
receive
(
:info
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment