Commit 50200a78 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch '212213-cablett-action-service-user-arg' into 'master'

Pass user rather than user ID to SpamActionService

See merge request gitlab-org/gitlab!30966
parents 65f04870 9a340628
...@@ -30,7 +30,7 @@ module SpamCheckMethods ...@@ -30,7 +30,7 @@ module SpamCheckMethods
api: @api, api: @api,
recaptcha_verified: @recaptcha_verified, recaptcha_verified: @recaptcha_verified,
spam_log_id: @spam_log_id, spam_log_id: @spam_log_id,
user_id: user.id) user: user)
end end
# rubocop:enable Gitlab/ModuleWithInstanceVariables # rubocop:enable Gitlab/ModuleWithInstanceVariables
end end
...@@ -22,11 +22,11 @@ module Spam ...@@ -22,11 +22,11 @@ module Spam
end end
end end
def execute(api: false, recaptcha_verified:, spam_log_id:, user_id:) def execute(api: false, recaptcha_verified:, spam_log_id:, user:)
if recaptcha_verified if recaptcha_verified
# If it's a request which is already verified through reCAPTCHA, # If it's a request which is already verified through reCAPTCHA,
# update the spam log accordingly. # update the spam log accordingly.
SpamLog.verify_recaptcha!(user_id: user_id, id: spam_log_id) SpamLog.verify_recaptcha!(user_id: user.id, id: spam_log_id)
else else
return unless request return unless request
return unless check_for_spam? return unless check_for_spam?
......
...@@ -78,7 +78,7 @@ describe Spam::SpamActionService do ...@@ -78,7 +78,7 @@ describe Spam::SpamActionService do
subject do subject do
described_service = described_class.new(spammable: issue, request: request) described_service = described_class.new(spammable: issue, request: request)
described_service.execute(user_id: user.id, api: nil, recaptcha_verified: recaptcha_verified, spam_log_id: existing_spam_log.id) described_service.execute(user: user, api: nil, recaptcha_verified: recaptcha_verified, spam_log_id: existing_spam_log.id)
end end
before do before do
......
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