mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
DEV: serialize image upload thumbnail (#29276)
Since we recently blocked accidental serialization of AR models, we are getting a 500 error in some cases with thumbnails. We can fix this by serializing the thumbnail, previously we just returned a raw OptimizedImage object. Thumbnails are now attached to the serializer in core, therefore we no longer need to use add_to_serializer within the chat plugin to use thumbnails within chat message uploads.
This commit is contained in:
@ -272,12 +272,6 @@ after_initialize do
|
||||
object.chat_separate_sidebar_mode
|
||||
end
|
||||
|
||||
add_to_serializer(
|
||||
:upload,
|
||||
:thumbnail,
|
||||
include_condition: -> { SiteSetting.chat_enabled && SiteSetting.create_thumbnails },
|
||||
) { object.thumbnail }
|
||||
|
||||
on(:site_setting_changed) do |name, old_value, new_value|
|
||||
user_option_field = Chat::RETENTION_SETTINGS_TO_USER_OPTION_FIELDS[name.to_sym]
|
||||
begin
|
||||
|
Reference in New Issue
Block a user