mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:25:24 +08:00
FEATURE: Add thumbnails for chat image uploads (#24328)
Introduces the concept of image thumbnails in chat, prior to this we uploaded and used full size chat images within channels and direct messages. The following changes are covered: - Post processing of image uploads to create the thumbnail within Chat::MessageProcessor - Extract responsive image ratios into CookedProcessorMixin (used for creating upload variations) - Add thumbnail to upload serializer from plugin.rb - Convert chat upload template to glimmer component using .gjs format - Use thumbnail image within chat upload component (stores full size img in orig-src data attribute) - Old uploads which don't have thumbnails will fallback to full size images in channels/DMs - Update Magnific lightbox to use full size image when clicked - Update Glimmer lightbox to use full size image (enables zooming for chat images)
This commit is contained in:
@ -253,6 +253,12 @@ after_initialize do
|
||||
object.chat_separate_sidebar_mode
|
||||
end
|
||||
|
||||
add_to_serializer(
|
||||
:upload,
|
||||
:thumbnail,
|
||||
include_condition: -> { SiteSetting.chat_enabled && SiteSetting.create_thumbnails },
|
||||
) { object.thumbnail }
|
||||
|
||||
RETENTION_SETTINGS_TO_USER_OPTION_FIELDS = {
|
||||
chat_channel_retention_days: :dismissed_channel_retention_reminder,
|
||||
chat_dm_retention_days: :dismissed_dm_retention_reminder,
|
||||
|
Reference in New Issue
Block a user