gitlab-org--gitlab-foss/app/services/spam/mark_as_spam_service.rb

25 lines
504 B
Ruby
Raw Normal View History

# 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