Commit 0c4e0b2c authored by charlie ablett's avatar charlie ablett

Merge branch 'stop-overriding-spamcheck-verdicts' into 'master'

Stop overriding spamcheck verdicts !=ALLOW to allow rescuing via reCAPTCHA.

See merge request gitlab-org/gitlab!71496
parents 6ffc0491 9602c08b
...@@ -73,18 +73,12 @@ module Spam ...@@ -73,18 +73,12 @@ module Spam
begin begin
result, attribs, _error = spamcheck_client.issue_spam?(spam_issue: target, user: user, context: context) result, attribs, _error = spamcheck_client.issue_spam?(spam_issue: target, user: user, context: context)
return [nil, attribs] unless result
# @TODO log if error is not nil https://gitlab.com/gitlab-org/gitlab/-/issues/329545 # @TODO log if error is not nil https://gitlab.com/gitlab-org/gitlab/-/issues/329545
return [result, attribs] if result == NOOP || attribs["monitorMode"] == "true" return [nil, attribs] unless result
[result, attribs]
# Duplicate logic with Akismet logic in #akismet_verdict
if Gitlab::Recaptcha.enabled? && result != ALLOW
[CONDITIONAL_ALLOW, attribs]
else
[result, attribs]
end
rescue StandardError => e rescue StandardError => e
Gitlab::ErrorTracking.log_exception(e) Gitlab::ErrorTracking.log_exception(e)
......
...@@ -267,8 +267,8 @@ RSpec.describe Spam::SpamVerdictService do ...@@ -267,8 +267,8 @@ RSpec.describe Spam::SpamVerdictService do
where(:verdict_value, :expected) do where(:verdict_value, :expected) do
::Spam::SpamConstants::ALLOW | ::Spam::SpamConstants::ALLOW ::Spam::SpamConstants::ALLOW | ::Spam::SpamConstants::ALLOW
::Spam::SpamConstants::CONDITIONAL_ALLOW | ::Spam::SpamConstants::CONDITIONAL_ALLOW ::Spam::SpamConstants::CONDITIONAL_ALLOW | ::Spam::SpamConstants::CONDITIONAL_ALLOW
::Spam::SpamConstants::DISALLOW | ::Spam::SpamConstants::CONDITIONAL_ALLOW ::Spam::SpamConstants::DISALLOW | ::Spam::SpamConstants::DISALLOW
::Spam::SpamConstants::BLOCK_USER | ::Spam::SpamConstants::CONDITIONAL_ALLOW ::Spam::SpamConstants::BLOCK_USER | ::Spam::SpamConstants::BLOCK_USER
end end
# rubocop: enable Lint/BinaryOperatorWithIdenticalOperands # rubocop: enable Lint/BinaryOperatorWithIdenticalOperands
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment