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
7421fef6
Commit
7421fef6
authored
Jul 10, 2020
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename spam_verdict to external_verdict
parent
a60e23f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
app/services/spam/spam_verdict_service.rb
app/services/spam/spam_verdict_service.rb
+2
-2
spec/services/spam/spam_verdict_service_spec.rb
spec/services/spam/spam_verdict_service_spec.rb
+6
-6
No files found.
app/services/spam/spam_verdict_service.rb
View file @
7421fef6
...
...
@@ -14,7 +14,7 @@ module Spam
end
def
execute
external_spam_check_result
=
spam
_verdict
external_spam_check_result
=
external
_verdict
akismet_result
=
akismet_verdict
# filter out anything we don't recognise, including nils.
...
...
@@ -38,7 +38,7 @@ module Spam
end
end
def
spam
_verdict
def
external
_verdict
return
unless
Gitlab
::
CurrentSettings
.
spam_check_endpoint_enabled
return
if
endpoint_url
.
blank?
...
...
spec/services/spam/spam_verdict_service_spec.rb
View file @
7421fef6
...
...
@@ -27,7 +27,7 @@ RSpec.describe Spam::SpamVerdictService do
before
do
allow
(
service
).
to
receive
(
:akismet_verdict
).
and_return
(
nil
)
allow
(
service
).
to
receive
(
:
spam_verdict
_verdict
).
and_return
(
nil
)
allow
(
service
).
to
receive
(
:
external
_verdict
).
and_return
(
nil
)
end
context
'if all services return nil'
do
...
...
@@ -62,7 +62,7 @@ RSpec.describe Spam::SpamVerdictService do
context
'and they are supported'
do
before
do
allow
(
service
).
to
receive
(
:akismet_verdict
).
and_return
(
DISALLOW
)
allow
(
service
).
to
receive
(
:
spam
_verdict
).
and_return
(
BLOCK_USER
)
allow
(
service
).
to
receive
(
:
external
_verdict
).
and_return
(
BLOCK_USER
)
end
it
'renders the more restrictive verdict'
do
...
...
@@ -73,7 +73,7 @@ RSpec.describe Spam::SpamVerdictService do
context
'and one is supported'
do
before
do
allow
(
service
).
to
receive
(
:akismet_verdict
).
and_return
(
'nonsense'
)
allow
(
service
).
to
receive
(
:
spam
_verdict
).
and_return
(
BLOCK_USER
)
allow
(
service
).
to
receive
(
:
external
_verdict
).
and_return
(
BLOCK_USER
)
end
it
'renders the more restrictive verdict'
do
...
...
@@ -84,7 +84,7 @@ RSpec.describe Spam::SpamVerdictService do
context
'and none are supported'
do
before
do
allow
(
service
).
to
receive
(
:akismet_verdict
).
and_return
(
'nonsense'
)
allow
(
service
).
to
receive
(
:
spam
_verdict
).
and_return
(
'rubbish'
)
allow
(
service
).
to
receive
(
:
external
_verdict
).
and_return
(
'rubbish'
)
end
it
'renders the more restrictive verdict'
do
...
...
@@ -149,8 +149,8 @@ RSpec.describe Spam::SpamVerdictService do
end
end
describe
'#
spam
_verdict'
do
subject
{
service
.
send
(
:
spam
_verdict
)
}
describe
'#
external
_verdict'
do
subject
{
service
.
send
(
:
external
_verdict
)
}
context
'if a Spam Check endpoint enabled and set to a URL'
do
let
(
:spam_check_body
)
{
{}
}
...
...
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