Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-20 02:18:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-20 02:18:09 +0300
commit6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch)
treedc4d20fe6064752c0bd323187252c77e0a89144b /app/services/spam/spam_verdict_service.rb
parent9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff)
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'app/services/spam/spam_verdict_service.rb')
-rw-r--r--app/services/spam/spam_verdict_service.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/services/spam/spam_verdict_service.rb b/app/services/spam/spam_verdict_service.rb
index e73b2666c02..08634ec840c 100644
--- a/app/services/spam/spam_verdict_service.rb
+++ b/app/services/spam/spam_verdict_service.rb
@@ -5,11 +5,12 @@ module Spam
include AkismetMethods
include SpamConstants
- def initialize(user:, target:, options:, context: {})
+ def initialize(user:, target:, options:, context: {}, extra_features: {})
@target = target
@user = user
@options = options
@context = context
+ @extra_features = extra_features
end
def execute
@@ -61,7 +62,7 @@ module Spam
private
- attr_reader :user, :target, :options, :context
+ attr_reader :user, :target, :options, :context, :extra_features
def akismet_verdict
if akismet.spam?
@@ -75,7 +76,8 @@ module Spam
return unless Gitlab::CurrentSettings.spam_check_endpoint_enabled
begin
- result, attribs, _error = spamcheck_client.issue_spam?(spam_issue: target, user: user, context: context)
+ result, attribs, _error = spamcheck_client.spam?(spammable: target, user: user, context: context,
+ extra_features: extra_features)
# @TODO log if error is not nil https://gitlab.com/gitlab-org/gitlab/-/issues/329545
return [nil, attribs] unless result
@@ -83,7 +85,7 @@ module Spam
[result, attribs]
rescue StandardError => e
- Gitlab::ErrorTracking.log_exception(e)
+ Gitlab::ErrorTracking.log_exception(e, error: ERROR_TYPE)
# Default to ALLOW if any errors occur
[ALLOW, attribs, true]