debian-mirror-gitlab/app/services/spam/mark_as_spam_service.rb
2020-04-08 14:13:33 +05:30

24 lines
504 B
Ruby

# frozen_string_literal: true
module Spam
class MarkAsSpamService
include ::AkismetMethods
attr_accessor :target, :options
def initialize(target:)
@target = target
@options = {}
@options[:ip_address] = @target.ip_address
@options[:user_agent] = @target.user_agent
end
def execute
return unless target.submittable_as_spam?
return unless akismet.submit_spam
target.user_agent_detail.update_attribute(:submitted, true)
end
end
end