Fix recent settings migrations (#36602)
This commit is contained in:
@@ -12,8 +12,7 @@ class MigrateTimelinePreviewSetting < ActiveRecord::Migration[8.0]
|
|||||||
Setting.upsert_all(
|
Setting.upsert_all(
|
||||||
%w(local_live_feed_access remote_live_feed_access local_topic_feed_access remote_topic_feed_access).map do |var|
|
%w(local_live_feed_access remote_live_feed_access local_topic_feed_access remote_topic_feed_access).map do |var|
|
||||||
{ var: var, value: value ? "--- public\n" : "--- authenticated\n" }
|
{ var: var, value: value ? "--- public\n" : "--- authenticated\n" }
|
||||||
end,
|
end
|
||||||
unique_by: :var
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ class MigrateLandingPageSetting < ActiveRecord::Migration[8.0]
|
|||||||
|
|
||||||
value = YAML.safe_load(setting.attributes['value'], permitted_classes: [ActiveSupport::HashWithIndifferentAccess, Symbol])
|
value = YAML.safe_load(setting.attributes['value'], permitted_classes: [ActiveSupport::HashWithIndifferentAccess, Symbol])
|
||||||
|
|
||||||
Setting.upsert(
|
Setting.upsert({
|
||||||
var: 'landing_page',
|
var: 'landing_page',
|
||||||
value: value ? "--- trends\n" : "--- about\n"
|
value: value ? "--- trends\n" : "--- about\n",
|
||||||
)
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
def down; end
|
def down; end
|
||||||
|
|||||||
@@ -144,6 +144,16 @@ namespace :tests do
|
|||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless Setting.landing_page == 'about'
|
||||||
|
puts 'Landing page settings not migrated as expected'
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
unless Setting.local_live_feed_access == 'authenticated'
|
||||||
|
puts 'Local live feed access not migrated as expected'
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
puts 'No errors found. Database state is consistent with a successful migration process.'
|
puts 'No errors found. Database state is consistent with a successful migration process.'
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -162,6 +172,13 @@ namespace :tests do
|
|||||||
(1, 'https://example.com/users/foobar', 'foobar@example.com', now(), now()),
|
(1, 'https://example.com/users/foobar', 'foobar@example.com', now(), now()),
|
||||||
(1, 'https://example.com/users/foobar', 'foobar@example.com', now(), now());
|
(1, 'https://example.com/users/foobar', 'foobar@example.com', now(), now());
|
||||||
|
|
||||||
|
/* trends_as_landing_page is technically not a 3.3.0 setting, but it's easier to just add it here */
|
||||||
|
INSERT INTO "settings"
|
||||||
|
(id, thing_type, thing_id, var, value, created_at, updated_at)
|
||||||
|
VALUES
|
||||||
|
(7, NULL, NULL, 'timeline_preview', E'--- false\n', now(), now()),
|
||||||
|
(8, NULL, NULL, 'trends_as_landing_page', E'--- false\n', now(), now());
|
||||||
|
|
||||||
/* Doorkeeper records
|
/* Doorkeeper records
|
||||||
While the `read:me` scope was technically not valid in 3.3.0,
|
While the `read:me` scope was technically not valid in 3.3.0,
|
||||||
it is still useful for the purposes of testing the `ChangeReadMeScopeToProfile`
|
it is still useful for the purposes of testing the `ChangeReadMeScopeToProfile`
|
||||||
|
|||||||
Reference in New Issue
Block a user