FIX: Resetting selectable avatars was failing (#16302)

This commit is contained in:
Penar Musaraj 2022-03-28 14:15:28 -04:00 committed by GitHub
parent 2b974d4992
commit b1211bee97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -508,6 +508,8 @@ module SiteSettingExtension
value = current[name]
end
return [] if value.empty?
value = value.split("|").map(&:to_i)
uploads_list = Upload.where(id: value).to_a
uploads[name] = uploads_list if uploads_list

View File

@ -254,8 +254,11 @@ describe SiteSettingExtension do
end
describe "remove_override" do
fab!(:upload) { Fabricate(:upload) }
before do
settings.setting(:test_override, "test")
settings.setting(:image_list_test, "", type: :uploaded_image_list)
settings.refresh!
end
it "correctly nukes overrides" do
@ -263,6 +266,12 @@ describe SiteSettingExtension do
settings.remove_override!(:test_override)
expect(settings.test_override).to eq("test")
end
it "correctly nukes overrides for image list type setting" do
settings.image_list_test = "#{upload.id}"
settings.remove_override!(:image_list_test)
expect(settings.image_list_test).to be_empty
end
end
describe "string setting" do