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
596c5cd4
Commit
596c5cd4
authored
Dec 10, 2021
by
John Mason
Committed by
Dmitry Gruzd
Dec 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change format of abuse detection logging
parent
4b83234b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
app/services/search_service.rb
app/services/search_service.rb
+1
-1
spec/services/search_service_spec.rb
spec/services/search_service_spec.rb
+21
-0
No files found.
app/services/search_service.rb
View file @
596c5cd4
...
...
@@ -80,7 +80,7 @@ class SearchService
def
abuse_messages
return
[]
unless
params
.
abusive?
params
.
abuse_detection
.
errors
.
messages
params
.
abuse_detection
.
errors
.
full_
messages
end
def
valid_request?
...
...
spec/services/search_service_spec.rb
View file @
596c5cd4
...
...
@@ -569,6 +569,27 @@ RSpec.describe SearchService do
end
end
describe
'#abuse_messages'
do
let
(
:scope
)
{
'issues'
}
let
(
:search
)
{
'foobar'
}
let
(
:params
)
{
instance_double
(
Gitlab
::
Search
::
Params
)
}
before
do
allow
(
Gitlab
::
Search
::
Params
).
to
receive
(
:new
).
and_return
(
params
)
end
it
'returns an empty array when not abusive'
do
allow
(
params
).
to
receive
(
:abusive?
).
and_return
false
expect
(
subject
.
abuse_messages
).
to
match_array
([])
end
it
'calls on abuse_detection.errors.full_messages when abusive'
do
allow
(
params
).
to
receive
(
:abusive?
).
and_return
true
expect
(
params
).
to
receive_message_chain
(
:abuse_detection
,
:errors
,
:full_messages
)
subject
.
abuse_messages
end
end
describe
'abusive search handling'
do
subject
{
described_class
.
new
(
user
,
raw_params
)
}
...
...
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