diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index 4a4c0f7d60..452b6bc300 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -321,21 +321,25 @@ void DocumentData::setattributes( dimensions = QSize(data.vw().v, data.vh().v); }, [&](const MTPDdocumentAttributeAnimated &data) { if (type == FileDocument - || type == StickerDocument - || type == VideoDocument) { + || type == VideoDocument + || (sticker() && sticker()->type != StickerType::Webm)) { type = AnimatedDocument; _additional = nullptr; } }, [&](const MTPDdocumentAttributeSticker &data) { - if (type == FileDocument) { + const auto was = type; + if (type == FileDocument || type == VideoDocument) { type = StickerDocument; _additional = std::make_unique(); } - if (sticker()) { - sticker()->alt = qs(data.valt()); - if (!sticker()->set.id + if (const auto info = sticker()) { + if (was == VideoDocument) { + info->type = StickerType::Webm; + } + info->alt = qs(data.valt()); + if (!info->set.id || data.vstickerset().type() == mtpc_inputStickerSetID) { - sticker()->set = data.vstickerset().match([&]( + info->set = data.vstickerset().match([&]( const MTPDinputStickerSetID &data) { return StickerSetIdentifier{ .id = data.vid().v, @@ -355,6 +359,8 @@ void DocumentData::setattributes( type = data.is_round_message() ? RoundVideoDocument : VideoDocument; + } else if (const auto info = sticker()) { + info->type = StickerType::Webm; } _duration = data.vduration().v; setMaybeSupportsStreaming(data.is_supports_streaming());