Split timeline_preview setting into more granular settings (#36338)
This commit is contained in:
@@ -14,7 +14,6 @@ class Form::AdminSettings
|
||||
site_terms
|
||||
registrations_mode
|
||||
closed_registrations_message
|
||||
timeline_preview
|
||||
bootstrap_timeline_accounts
|
||||
theme
|
||||
activity_api_enabled
|
||||
@@ -41,6 +40,10 @@ class Form::AdminSettings
|
||||
app_icon
|
||||
favicon
|
||||
min_age
|
||||
local_live_feed_access
|
||||
remote_live_feed_access
|
||||
local_topic_feed_access
|
||||
remote_topic_feed_access
|
||||
).freeze
|
||||
|
||||
INTEGER_KEYS = %i(
|
||||
@@ -84,6 +87,7 @@ class Form::AdminSettings
|
||||
DESCRIPTION_LIMIT = 200
|
||||
DOMAIN_BLOCK_AUDIENCES = %w(disabled users all).freeze
|
||||
REGISTRATION_MODES = %w(open approved none).freeze
|
||||
FEED_ACCESS_MODES = %w(public authenticated).freeze
|
||||
|
||||
attr_accessor(*KEYS)
|
||||
|
||||
@@ -93,6 +97,10 @@ class Form::AdminSettings
|
||||
validates :bootstrap_timeline_accounts, existing_username: { multiple: true }, if: -> { defined?(@bootstrap_timeline_accounts) }
|
||||
validates :show_domain_blocks, inclusion: { in: DOMAIN_BLOCK_AUDIENCES }, if: -> { defined?(@show_domain_blocks) }
|
||||
validates :show_domain_blocks_rationale, inclusion: { in: DOMAIN_BLOCK_AUDIENCES }, if: -> { defined?(@show_domain_blocks_rationale) }
|
||||
validates :local_live_feed_access, inclusion: { in: FEED_ACCESS_MODES }, if: -> { defined?(@local_live_feed_access) }
|
||||
validates :remote_live_feed_access, inclusion: { in: FEED_ACCESS_MODES }, if: -> { defined?(@remote_live_feed_access) }
|
||||
validates :local_topic_feed_access, inclusion: { in: FEED_ACCESS_MODES }, if: -> { defined?(@local_topic_feed_access) }
|
||||
validates :remote_topic_feed_access, inclusion: { in: FEED_ACCESS_MODES }, if: -> { defined?(@remote_topic_feed_access) }
|
||||
validates :media_cache_retention_period, :content_cache_retention_period, :backups_retention_period, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@media_cache_retention_period) || defined?(@content_cache_retention_period) || defined?(@backups_retention_period) }
|
||||
validates :min_age, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@min_age) }
|
||||
validates :site_short_description, length: { maximum: DESCRIPTION_LIMIT }, if: -> { defined?(@site_short_description) }
|
||||
|
||||
Reference in New Issue
Block a user