debian-mirror-gitlab/app/services/spam/mark_as_spam_service.rb

25 lines
528 B
Ruby
Raw Normal View History

2020-03-09 13:42:32 +05:30
# frozen_string_literal: true
module Spam
class MarkAsSpamService
include ::AkismetMethods
attr_accessor :spammable, :options
def initialize(spammable:)
@spammable = spammable
@options = {}
@options[:ip_address] = @spammable.ip_address
@options[:user_agent] = @spammable.user_agent
end
def execute
return unless spammable.submittable_as_spam?
return unless akismet.submit_spam
spammable.user_agent_detail.update_attribute(:submitted, true)
end
end
end