mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Fixed update of recently attached stickers after sending.
This commit is contained in:
@@ -52,6 +52,10 @@ mtpRequestId EditMessage(
|
||||
ConvertOption::SkipLocal);
|
||||
const auto media = item->media();
|
||||
|
||||
const auto updateRecentStickers = inputMedia.has_value()
|
||||
? Api::HasAttachedStickers(*inputMedia)
|
||||
: false;
|
||||
|
||||
const auto emptyFlag = MTPmessages_EditMessage::Flag(0);
|
||||
const auto flags = emptyFlag
|
||||
| (!text.isEmpty() || media
|
||||
@@ -97,6 +101,10 @@ mtpRequestId EditMessage(
|
||||
} else {
|
||||
apply();
|
||||
}
|
||||
|
||||
if (updateRecentStickers) {
|
||||
api->requestRecentStickersForce(true);
|
||||
}
|
||||
}).fail(
|
||||
fail
|
||||
).send();
|
||||
|
@@ -111,4 +111,16 @@ MTPInputMedia PrepareUploadedDocument(
|
||||
MTP_int(0));
|
||||
}
|
||||
|
||||
bool HasAttachedStickers(MTPInputMedia media) {
|
||||
return media.match([&](const MTPDinputMediaUploadedPhoto &photo) -> bool {
|
||||
return (photo.vflags().v
|
||||
& MTPDinputMediaUploadedPhoto::Flag::f_stickers);
|
||||
}, [&](const MTPDinputMediaUploadedDocument &document) -> bool {
|
||||
return (document.vflags().v
|
||||
& MTPDinputMediaUploadedDocument::Flag::f_stickers);
|
||||
}, [](const auto &d) {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
|
@@ -21,4 +21,6 @@ MTPInputMedia PrepareUploadedDocument(
|
||||
const std::optional<MTPInputFile> &thumb,
|
||||
std::vector<MTPInputDocument> attachedStickers);
|
||||
|
||||
bool HasAttachedStickers(MTPInputMedia media);
|
||||
|
||||
} // namespace Api
|
||||
|
Reference in New Issue
Block a user