debian-mirror-gitlab/lib/gitlab/spamcheck/result.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
839 B
Ruby
Raw Normal View History

2023-07-09 08:55:56 +05:30
# frozen_string_literal: true
module Gitlab
module Spamcheck
class Result
include ::Spam::SpamConstants
attr_reader :response
VERDICT_MAPPING = {
::Spamcheck::SpamVerdict::Verdict::ALLOW => ALLOW,
::Spamcheck::SpamVerdict::Verdict::CONDITIONAL_ALLOW => CONDITIONAL_ALLOW,
::Spamcheck::SpamVerdict::Verdict::DISALLOW => DISALLOW,
::Spamcheck::SpamVerdict::Verdict::BLOCK => BLOCK_USER,
::Spamcheck::SpamVerdict::Verdict::NOOP => NOOP
}.freeze
def initialize(response)
@response = response
end
def score
response.score
end
def verdict
VERDICT_MAPPING.fetch(::Spamcheck::SpamVerdict::Verdict.resolve(response.verdict), ALLOW)
end
def evaluated?
response.evaluated
end
end
end
end