Commit 5c79d79d authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'cablett-spam-tidy-mark-method' into 'master'

Refactor `spammable_owner_id` method

See merge request gitlab-org/gitlab!23224
parents 27f42a1b f8868718
......@@ -2,16 +2,7 @@
module AkismetMethods
def spammable_owner
@user ||= User.find(spammable_owner_id)
end
def spammable_owner_id
@owner_id ||=
if spammable.respond_to?(:author_id)
spammable.author_id
elsif spammable.respond_to?(:creator_id)
spammable.creator_id
end
@user ||= User.find(spammable.author_id)
end
def akismet
......
......@@ -53,7 +53,7 @@ class SpamService
def create_spam_log(api)
@spam_log = SpamLog.create!(
{
user_id: spammable_owner_id,
user_id: spammable.author_id,
title: spammable.spam_title,
description: spammable.spam_description,
source_ip: options[:ip_address],
......
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