debian-mirror-gitlab/app/services/spam/akismet_mark_as_spam_service.rb
2021-10-27 15:23:28 +05:30

24 lines
511 B
Ruby

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