mirror of
https://github.com/mastodon/mastodon.git
synced 2025-01-03 21:43:13 +01:00
Split setting for timeline_preview into timeline_preview_local and timeline_preview_remote
This commit is contained in:
parent
2d589a5ed4
commit
17ea727950
3 changed files with 31 additions and 3 deletions
|
@ -14,7 +14,8 @@ class Form::AdminSettings
|
||||||
site_terms
|
site_terms
|
||||||
registrations_mode
|
registrations_mode
|
||||||
closed_registrations_message
|
closed_registrations_message
|
||||||
timeline_preview
|
timeline_preview_local
|
||||||
|
timeline_preview_remote
|
||||||
bootstrap_timeline_accounts
|
bootstrap_timeline_accounts
|
||||||
theme
|
theme
|
||||||
activity_api_enabled
|
activity_api_enabled
|
||||||
|
@ -48,7 +49,8 @@ class Form::AdminSettings
|
||||||
).freeze
|
).freeze
|
||||||
|
|
||||||
BOOLEAN_KEYS = %i(
|
BOOLEAN_KEYS = %i(
|
||||||
timeline_preview
|
timeline_preview_local
|
||||||
|
timeline_preview_remote
|
||||||
activity_api_enabled
|
activity_api_enabled
|
||||||
peers_api_enabled
|
peers_api_enabled
|
||||||
preview_sensitive_media
|
preview_sensitive_media
|
||||||
|
|
|
@ -12,7 +12,8 @@ defaults: &defaults
|
||||||
registrations_mode: 'none'
|
registrations_mode: 'none'
|
||||||
profile_directory: true
|
profile_directory: true
|
||||||
closed_registrations_message: ''
|
closed_registrations_message: ''
|
||||||
timeline_preview: true
|
timeline_preview_local: true
|
||||||
|
timeline_preview_remote: false
|
||||||
show_staff_badge: true
|
show_staff_badge: true
|
||||||
preview_sensitive_media: false
|
preview_sensitive_media: false
|
||||||
noindex: false
|
noindex: false
|
||||||
|
|
25
db/migrate/20240817155611_split_public_timelines_setting.rb
Normal file
25
db/migrate/20240817155611_split_public_timelines_setting.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class SplitPublicTimelinesSetting < ActiveRecord::Migration[7.1]
|
||||||
|
def up
|
||||||
|
previous_setting = Setting.find_by(var: 'timeline_preview')
|
||||||
|
|
||||||
|
unless previous_setting.nil?
|
||||||
|
Setting['timeline_preview_local'] = previous_setting.value
|
||||||
|
Setting['timeline_preview_remote'] = previous_setting.value
|
||||||
|
previous_setting.delete
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
preview_local = Setting['timeline_preview_local']
|
||||||
|
preview_remote = Setting['timeline_preview_remote']
|
||||||
|
|
||||||
|
unless preview_local.nil? && preview_remote.nil?
|
||||||
|
preview_timelines = (!preview_local.nil? && preview_local) && (!preview_remote.nil? && preview_remote)
|
||||||
|
Setting['timeline_preview'] = preview_timelines
|
||||||
|
end
|
||||||
|
|
||||||
|
Setting.where(var: ['timeline_preview_local', 'timeline_preview_remote']).delete_all
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue