DEV: Move sidebar site settings to the sidebar category (#18596)
Sidebar category is only shown in the admin panel when `enable_experimental_sidebar_hamburger` site setting is enabled
This commit is contained in:
parent
3d59f767ae
commit
d1304ecb46
|
@ -2033,6 +2033,18 @@ developer:
|
||||||
default: false
|
default: false
|
||||||
client: true
|
client: true
|
||||||
hidden: true
|
hidden: true
|
||||||
|
enable_new_user_profile_nav_groups:
|
||||||
|
client: true
|
||||||
|
type: group_list
|
||||||
|
list_type: compact
|
||||||
|
default: ""
|
||||||
|
allow_any: false
|
||||||
|
refresh: true
|
||||||
|
include_associated_account_ids:
|
||||||
|
default: false
|
||||||
|
hidden: true
|
||||||
|
|
||||||
|
sidebar:
|
||||||
enable_sidebar:
|
enable_sidebar:
|
||||||
default: true
|
default: true
|
||||||
client: true
|
client: true
|
||||||
|
@ -2044,16 +2056,6 @@ developer:
|
||||||
type: tag_list
|
type: tag_list
|
||||||
default: ""
|
default: ""
|
||||||
client: true
|
client: true
|
||||||
enable_new_user_profile_nav_groups:
|
|
||||||
client: true
|
|
||||||
type: group_list
|
|
||||||
list_type: compact
|
|
||||||
default: ""
|
|
||||||
allow_any: false
|
|
||||||
refresh: true
|
|
||||||
include_associated_account_ids:
|
|
||||||
default: false
|
|
||||||
hidden: true
|
|
||||||
|
|
||||||
embedding:
|
embedding:
|
||||||
embed_by_username:
|
embed_by_username:
|
||||||
|
|
|
@ -234,36 +234,42 @@ module SiteSettingExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
defaults.all(default_locale)
|
defaults.all(default_locale)
|
||||||
.reject { |s, _| !include_hidden && hidden_settings.include?(s) }
|
.reject do |setting_name, _|
|
||||||
.map do |s, v|
|
if !include_hidden && hidden_settings.include?(setting_name)
|
||||||
|
true
|
||||||
|
elsif categories[setting_name].to_s == "sidebar" && !SiteSetting.enable_experimental_sidebar_hamburger
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end.map do |s, v|
|
||||||
|
type_hash = type_supervisor.type_hash(s)
|
||||||
|
default = defaults.get(s, default_locale).to_s
|
||||||
|
|
||||||
type_hash = type_supervisor.type_hash(s)
|
value = public_send(s)
|
||||||
default = defaults.get(s, default_locale).to_s
|
value = value.map(&:to_s).join("|") if type_hash[:type].to_s == "uploaded_image_list"
|
||||||
|
|
||||||
value = public_send(s)
|
if type_hash[:type].to_s == "upload" &&
|
||||||
value = value.map(&:to_s).join("|") if type_hash[:type].to_s == "uploaded_image_list"
|
default.to_i < Upload::SEEDED_ID_THRESHOLD
|
||||||
|
|
||||||
if type_hash[:type].to_s == "upload" &&
|
default = default_uploads[default.to_i]
|
||||||
default.to_i < Upload::SEEDED_ID_THRESHOLD
|
end
|
||||||
|
|
||||||
default = default_uploads[default.to_i]
|
opts = {
|
||||||
end
|
setting: s,
|
||||||
|
description: description(s),
|
||||||
|
default: default,
|
||||||
|
value: value.to_s,
|
||||||
|
category: categories[s],
|
||||||
|
preview: previews[s],
|
||||||
|
secret: secret_settings.include?(s),
|
||||||
|
placeholder: placeholder(s)
|
||||||
|
}.merge!(type_hash)
|
||||||
|
|
||||||
opts = {
|
opts[:plugin] = plugins[s] if plugins[s]
|
||||||
setting: s,
|
|
||||||
description: description(s),
|
|
||||||
default: default,
|
|
||||||
value: value.to_s,
|
|
||||||
category: categories[s],
|
|
||||||
preview: previews[s],
|
|
||||||
secret: secret_settings.include?(s),
|
|
||||||
placeholder: placeholder(s)
|
|
||||||
}.merge!(type_hash)
|
|
||||||
|
|
||||||
opts[:plugin] = plugins[s] if plugins[s]
|
opts
|
||||||
|
end.unshift(locale_setting_hash)
|
||||||
opts
|
|
||||||
end.unshift(locale_setting_hash)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def description(setting)
|
def description(setting)
|
||||||
|
|
|
@ -832,4 +832,24 @@ RSpec.describe SiteSettingExtension do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'sidebar category site settings' do
|
||||||
|
describe '.all_settings' do
|
||||||
|
before do
|
||||||
|
settings.setting(:test_setting, 88, category: :sidebar)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not include the sidebar category setting when enable_experimental_sidebar_hamburger site setting is disabled' do
|
||||||
|
SiteSetting.enable_experimental_sidebar_hamburger = false
|
||||||
|
|
||||||
|
expect(settings.all_settings.detect { |s| s[:setting] == :test_setting }).to eq(nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'includes the sidebar category setting when enable_experimental_sidebar_hamburger site setting is enabled' do
|
||||||
|
SiteSetting.enable_experimental_sidebar_hamburger = true
|
||||||
|
|
||||||
|
expect(settings.all_settings.detect { |s| s[:setting] == :test_setting }[:setting]).to eq(:test_setting)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue