Commit 9a340628 authored by charlieablett's avatar charlieablett

Pass user rather than user ID to SpamActionService

parent 58d207af
......@@ -30,7 +30,7 @@ module SpamCheckMethods
api: @api,
recaptcha_verified: @recaptcha_verified,
spam_log_id: @spam_log_id,
user_id: user.id)
user: user)
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
end
......@@ -22,11 +22,11 @@ module Spam
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 it's a request which is already verified through reCAPTCHA,
# 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
return unless request
return unless check_for_spam?
......
......@@ -78,7 +78,7 @@ describe Spam::SpamActionService do
subject do
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
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