mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-19 05:35:40 +08:00
23 lines
497 B
Ruby
Vendored
23 lines
497 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module DiscourseAi
|
|
module Configuration
|
|
class SpamDetectionValidator
|
|
def initialize(opts = {})
|
|
@opts = opts
|
|
end
|
|
|
|
def valid_value?(val)
|
|
# only validate when enabling spam detection
|
|
return true if val == "f" || val == "false"
|
|
return true if AiModerationSetting.spam
|
|
|
|
false
|
|
end
|
|
|
|
def error_message
|
|
I18n.t("discourse_ai.spam_detection.configuration_missing")
|
|
end
|
|
end
|
|
end
|
|
end
|