discourse/lib/validators/topic_setting_validator.rb
Ted Johansson 540dc392cd
FEATURE: Add new configurable moderation guide (#36287)
This PR adds a new site setting for configuring a community moderation topic that will be linked from the reviewable sidebar.

It involves adding a new site setting type "topic" which uses the TopicChooser component in the front-end.
2025-12-01 10:30:32 +08:00

15 lines
275 B
Ruby

# frozen_string_literal: true
class TopicSettingValidator
def initialize(opts = {})
@opts = opts
end
def valid_value?(val)
val.blank? || Topic.with_deleted.exists?(id: val)
end
def error_message
I18n.t("site_settings.errors.invalid_topic")
end
end