FIX: Allow Symbol objects to be deserialized in PostRevision (#17510)

Followup to ee07f6da7d
This commit is contained in:
David Taylor 2022-07-15 13:14:57 +01:00 committed by GitHub
parent 7cf95e6339
commit f774083016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -102,7 +102,7 @@ module Discourse
config.action_controller.forgery_protection_origin_check = false config.action_controller.forgery_protection_origin_check = false
config.active_record.belongs_to_required_by_default = false config.active_record.belongs_to_required_by_default = false
config.active_record.legacy_connection_handling = true config.active_record.legacy_connection_handling = true
config.active_record.yaml_column_permitted_classes = [Hash, HashWithIndifferentAccess, Time] config.active_record.yaml_column_permitted_classes = [Hash, HashWithIndifferentAccess, Time, Symbol]
# we skip it cause we configure it in the initializer # we skip it cause we configure it in the initializer
# the railtie for message_bus would insert it in the # the railtie for message_bus would insert it in the

View File

@ -23,4 +23,15 @@ describe PostRevision do
} }
) )
end end
it "can serialize and deserialize symbols" do
# Plugins may store symbolized values in this column
pr = Fabricate(:post_revision, modifications: { key: :value })
pr.reload
expect(pr.modifications).to eq(
{
key: :value
}
)
end
end end