mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-07-01 03:52:34 +00:00
23 lines
431 B
Ruby
23 lines
431 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module DiscourseAi
|
||
|
module Configuration
|
||
|
class SpamDetectionValidator
|
||
|
def initialize(opts = {})
|
||
|
@opts = opts
|
||
|
end
|
||
|
|
||
|
def valid_value?(val)
|
||
|
return true if Rails.env.test?
|
||
|
return true if AiModerationSetting.spam
|
||
|
|
||
|
false
|
||
|
end
|
||
|
|
||
|
def error_message
|
||
|
I18n.t("discourse_ai.spam_detection.configuration_missing")
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|