mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-02 07:25:46 +00:00
Fixed update of recently attached stickers after sending.
This commit is contained in:
@@ -52,6 +52,10 @@ mtpRequestId EditMessage(
|
|||||||
ConvertOption::SkipLocal);
|
ConvertOption::SkipLocal);
|
||||||
const auto media = item->media();
|
const auto media = item->media();
|
||||||
|
|
||||||
|
const auto updateRecentStickers = inputMedia.has_value()
|
||||||
|
? Api::HasAttachedStickers(*inputMedia)
|
||||||
|
: false;
|
||||||
|
|
||||||
const auto emptyFlag = MTPmessages_EditMessage::Flag(0);
|
const auto emptyFlag = MTPmessages_EditMessage::Flag(0);
|
||||||
const auto flags = emptyFlag
|
const auto flags = emptyFlag
|
||||||
| (!text.isEmpty() || media
|
| (!text.isEmpty() || media
|
||||||
@@ -97,6 +101,10 @@ mtpRequestId EditMessage(
|
|||||||
} else {
|
} else {
|
||||||
apply();
|
apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateRecentStickers) {
|
||||||
|
api->requestRecentStickersForce(true);
|
||||||
|
}
|
||||||
}).fail(
|
}).fail(
|
||||||
fail
|
fail
|
||||||
).send();
|
).send();
|
||||||
|
@@ -111,4 +111,16 @@ MTPInputMedia PrepareUploadedDocument(
|
|||||||
MTP_int(0));
|
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
|
} // namespace Api
|
||||||
|
@@ -21,4 +21,6 @@ MTPInputMedia PrepareUploadedDocument(
|
|||||||
const std::optional<MTPInputFile> &thumb,
|
const std::optional<MTPInputFile> &thumb,
|
||||||
std::vector<MTPInputDocument> attachedStickers);
|
std::vector<MTPInputDocument> attachedStickers);
|
||||||
|
|
||||||
|
bool HasAttachedStickers(MTPInputMedia media);
|
||||||
|
|
||||||
} // namespace Api
|
} // namespace Api
|
||||||
|
@@ -4521,6 +4521,8 @@ void ApiWrap::sendMediaWithRandomId(
|
|||||||
caption.entities,
|
caption.entities,
|
||||||
Api::ConvertOption::SkipLocal);
|
Api::ConvertOption::SkipLocal);
|
||||||
|
|
||||||
|
const auto updateRecentStickers = Api::HasAttachedStickers(media);
|
||||||
|
|
||||||
const auto flags = MTPmessages_SendMedia::Flags(0)
|
const auto flags = MTPmessages_SendMedia::Flags(0)
|
||||||
| (replyTo
|
| (replyTo
|
||||||
? MTPmessages_SendMedia::Flag::f_reply_to_msg_id
|
? MTPmessages_SendMedia::Flag::f_reply_to_msg_id
|
||||||
@@ -4553,6 +4555,10 @@ void ApiWrap::sendMediaWithRandomId(
|
|||||||
)).done([=](const MTPUpdates &result) {
|
)).done([=](const MTPUpdates &result) {
|
||||||
applyUpdates(result);
|
applyUpdates(result);
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
|
if (updateRecentStickers) {
|
||||||
|
requestRecentStickersForce(true);
|
||||||
|
}
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
sendMessageFail(error, peer, randomId, itemId);
|
sendMessageFail(error, peer, randomId, itemId);
|
||||||
finish();
|
finish();
|
||||||
|
@@ -110,7 +110,6 @@ rpl::producer<uint64> Stickers::stickerSetInstalled() const {
|
|||||||
return _stickerSetInstalled.events();
|
return _stickerSetInstalled.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increment attached sticker.
|
|
||||||
void Stickers::incrementSticker(not_null<DocumentData*> document) {
|
void Stickers::incrementSticker(not_null<DocumentData*> document) {
|
||||||
if (!document->sticker()
|
if (!document->sticker()
|
||||||
|| document->sticker()->set.type() == mtpc_inputStickerSetEmpty) {
|
|| document->sticker()->set.type() == mtpc_inputStickerSetEmpty) {
|
||||||
|
Reference in New Issue
Block a user