diff options
Diffstat (limited to 'app/models/form/admin_settings.rb')
-rw-r--r-- | app/models/form/admin_settings.rb | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb index 97fabc6ac..4c100ba6b 100644 --- a/app/models/form/admin_settings.rb +++ b/app/models/form/admin_settings.rb @@ -16,22 +16,30 @@ class Form::AdminSettings open_deletion timeline_preview bootstrap_timeline_accounts - theme + flavour + skin activity_api_enabled peers_api_enabled show_known_fediverse_at_about_page preview_sensitive_media custom_css profile_directory + hide_followers_count + flavour_and_skin thumbnail hero mascot + show_reblogs_in_public_timelines + show_replies_in_public_timelines trends trendable_by_default + trending_status_cw show_domain_blocks show_domain_blocks_rationale noindex + outgoing_spoilers require_invite_text + captcha_enabled ).freeze BOOLEAN_KEYS = %i( @@ -42,10 +50,15 @@ class Form::AdminSettings show_known_fediverse_at_about_page preview_sensitive_media profile_directory + hide_followers_count + show_reblogs_in_public_timelines + show_replies_in_public_timelines trends trendable_by_default + trending_status_cw noindex require_invite_text + captcha_enabled ).freeze UPLOAD_KEYS = %i( @@ -54,6 +67,10 @@ class Form::AdminSettings mascot ).freeze + PSEUDO_KEYS = %i( + flavour_and_skin + ).freeze + attr_accessor(*KEYS) validates :site_short_description, :site_description, html: { wrap_with: :p } @@ -74,6 +91,7 @@ class Form::AdminSettings return false unless valid? KEYS.each do |key| + next if PSEUDO_KEYS.include?(key) value = instance_variable_get("@#{key}") if UPLOAD_KEYS.include?(key) && !value.nil? @@ -86,10 +104,19 @@ class Form::AdminSettings end end + def flavour_and_skin + "#{Setting.flavour}/#{Setting.skin}" + end + + def flavour_and_skin=(value) + @flavour, @skin = value.split('/', 2) + end + private def initialize_attributes KEYS.each do |key| + next if PSEUDO_KEYS.include?(key) instance_variable_set("@#{key}", Setting.public_send(key)) if instance_variable_get("@#{key}").nil? end end |