mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-03 08:18:42 +08:00
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.
15 lines
275 B
Ruby
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
|