diff options
Diffstat (limited to 'app/models/form')
-rw-r--r-- | app/models/form/admin_settings.rb | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb index de965cb0b..eaee142fa 100644 --- a/app/models/form/admin_settings.rb +++ b/app/models/form/admin_settings.rb @@ -14,21 +14,29 @@ class Form::AdminSettings closed_registrations_message timeline_preview bootstrap_timeline_accounts - theme + flavour + skin activity_api_enabled peers_api_enabled preview_sensitive_media custom_css profile_directory + hide_followers_count + flavour_and_skin thumbnail mascot + show_reblogs_in_public_timelines + show_replies_in_public_timelines trends trends_as_landing_page trendable_by_default + trending_status_cw show_domain_blocks show_domain_blocks_rationale noindex + outgoing_spoilers require_invite_text + captcha_enabled media_cache_retention_period content_cache_retention_period backups_retention_period @@ -47,11 +55,16 @@ class Form::AdminSettings peers_api_enabled preview_sensitive_media profile_directory + hide_followers_count + show_reblogs_in_public_timelines + show_replies_in_public_timelines trends trends_as_landing_page trendable_by_default + trending_status_cw noindex require_invite_text + captcha_enabled ).freeze UPLOAD_KEYS = %i( @@ -59,6 +72,10 @@ class Form::AdminSettings mascot ).freeze + PSEUDO_KEYS = %i( + flavour_and_skin + ).freeze + attr_accessor(*KEYS) validates :registrations_mode, inclusion: { in: %w(open approved none) }, if: -> { defined?(@registrations_mode) } @@ -102,7 +119,7 @@ class Form::AdminSettings return false unless errors.empty? && valid? KEYS.each do |key| - next unless instance_variable_defined?("@#{key}") + next if PSEUDO_KEYS.include?(key) || !instance_variable_defined?("@#{key}") if UPLOAD_KEYS.include?(key) public_send(key).save @@ -113,6 +130,14 @@ 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 typecast_value(key, value) |