mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 06:06:46 +08:00
DEV: add a plugin modifier to change hidden site settings (#24160)
Plugins can use a new modifier to change which site settings are hidden using the :hidden_site_settings modifier. For example: ``` register_modifier(:hidden_site_settings) do |hidden| (hidden + [:invite_only, :login_required]).uniq end ```
This commit is contained in:
19
lib/site_settings/hidden_provider.rb
Normal file
19
lib/site_settings/hidden_provider.rb
Normal file
@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module SiteSettings
|
||||
end
|
||||
|
||||
# A class to store and modify hidden site settings
|
||||
class SiteSettings::HiddenProvider
|
||||
def initialize
|
||||
@hidden_settings = Set.new
|
||||
end
|
||||
|
||||
def add_hidden(site_setting_name)
|
||||
@hidden_settings << site_setting_name
|
||||
end
|
||||
|
||||
def all
|
||||
DiscoursePluginRegistry.apply_modifier(:hidden_site_settings, @hidden_settings)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user