Fix recent settings migrations (#36602)

pull/36604/head
Claire 1 week ago committed by GitHub
parent ab5b7e3776
commit 38f15a89fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -12,8 +12,7 @@ class MigrateTimelinePreviewSetting < ActiveRecord::Migration[8.0]
Setting.upsert_all(
%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" }
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])
Setting.upsert(
Setting.upsert({
var: 'landing_page',
value: value ? "--- trends\n" : "--- about\n"
)
value: value ? "--- trends\n" : "--- about\n",
})
end
def down; end

@ -144,6 +144,16 @@ namespace :tests do
exit(1)
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.'
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());
/* 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
While the `read:me` scope was technically not valid in 3.3.0,
it is still useful for the purposes of testing the `ChangeReadMeScopeToProfile`

Loading…
Cancel
Save