Commit f8868718 authored by charlieablett's avatar charlieablett

Refactor akismet method

parent f3544845
......@@ -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