diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-06 18:09:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-06 18:09:27 +0300 |
commit | 638e2f1c5f55988135da63c7aa57bcecb9355a2b (patch) | |
tree | c25a1deeec9e02411f52a5eb831c42fa41778f9a /app/services/spam | |
parent | 4958d96e262f6b31b2850123e4949536555b2d29 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/spam')
-rw-r--r-- | app/services/spam/spam_action_service.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/app/services/spam/spam_action_service.rb b/app/services/spam/spam_action_service.rb index 7c96f003e46..9a55576384b 100644 --- a/app/services/spam/spam_action_service.rb +++ b/app/services/spam/spam_action_service.rb @@ -4,9 +4,8 @@ module Spam class SpamActionService include SpamConstants - def initialize(spammable:, spam_params:, user:, action:, extra_features: {}) + def initialize(spammable:, user:, action:, extra_features: {}) @target = spammable - @spam_params = spam_params @user = user @action = action @extra_features = extra_features @@ -14,10 +13,6 @@ module Spam # rubocop:disable Metrics/AbcSize def execute - # If spam_params is passed as `nil`, no check will be performed. This is the easiest way to allow - # composed services which may not need to do spam checking to "opt out". For example, when - # MoveService is calling CreateService, spam checking is not necessary, as no new content is - # being created. return ServiceResponse.success(message: 'Skipped spam check because spam_params was not present') unless spam_params recaptcha_verified = Captcha::CaptchaVerificationService.new(spam_params: spam_params).execute @@ -41,7 +36,11 @@ module Spam private - attr_reader :user, :action, :target, :spam_params, :spam_log, :extra_features + attr_reader :user, :action, :target, :spam_log, :extra_features + + def spam_params + Gitlab::RequestContext.instance.spam_params + end ## # In order to be proceed to the spam check process, the target must be |