fix: save and display media in message history#381
Open
denfry wants to merge 1 commit into
Open
Conversation
…ter and group deletion issues - Reset DPR on scaled tray icon logo to fix counter misalignment at high DPI AyuAssets::currentAppLogo() sets devicePixelRatio to style::DevicePixelRatio() (e.g. 2.0 at 200% scaling). After scaledToWidth() Qt preserves that DPR, making the logical canvas smaller than args.size while WithSmallCounter uses args.size as drawing coordinates — causing the badge to render partially outside bounds (visible as a grey triangle). Upstream loads from PNG files (DPR=1), so this mismatch only affects AyuGram. Fixes AyuGram#310 - Save and display media in message history Deleted/edited messages with media (photos, videos, voice notes, stickers, etc.) only stored a text placeholder. Media metadata was never serialized to the DB and the history viewer always passed MTP_messageMediaEmpty() to makeMessage(). Added kDocumentType* constants, AyuMapper::mapMediaToMessage() to serialize MTPInputDocument/MTPInputPhoto into documentSerialized, and resolveMedia() lambda in GenerateItems() to reconstruct MTPDocument/MTPPhoto with proper attributes (video, sticker, voice, audio, animated) for correct rendering - Save media-only deleted messages with type placeholder - Show delete own messages option for admins and creators in groups - Save expired TTL messages deleted via auto-delete in groups - Remove deleted messages from shared media index to fix incorrect counts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Deleted and edited messages with media (photos, videos, voice notes, stickers, GIFs, etc.) were stored in the database with a stub
mediaPath = "/"anddocumentType = 0. The history viewer always passedMTP_messageMediaEmpty()tomakeMessage(), so real media was never shown — only a text placeholder like "Photo" or "Video".Solution
Storage (
ayu_mapper.cpp,messages_storage.cpp):kDocumentType*constants for media type classificationAyuMapper::mapMediaToMessage()which serializesMTPInputDocument/MTPInputPhotointodocumentSerialized, setsdocumentType,mimeType, andmediaPathif the file is locally cachedmap()with a singleAyuMapper::mapMediaToMessage(item, message)callDisplay (
history_item.cpp):resolveMedia()lambda inGenerateItems()that deserializes the stored input, looks up the document/photo from session cache, and reconstructs a minimalMTPDocument/MTPPhotoDocumentDatapublic API: video (withround_message/supports_streamingflags), animated, sticker, audio/song, voice — so media renders with correct icons and controlsNotes