Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ham_service.rb « spam « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d0f53eea90c27401114bf7571c5b4c7f7c7f6f54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module Spam
  class HamService
    include AkismetMethods

    attr_accessor :spam_log, :options

    def initialize(spam_log)
      @spam_log = spam_log
      @user = spam_log.user
      @options = {
          ip_address: spam_log.source_ip,
          user_agent: spam_log.user_agent
      }
    end

    def execute
      if akismet.submit_ham
        spam_log.update_attribute(:submitted_as_ham, true)
      else
        false
      end
    end

    alias_method :spammable, :spam_log
  end
end