2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Short poll extended media.

This commit is contained in:
John Preston
2022-09-12 18:18:31 +04:00
parent 379736a7d1
commit 40bdcd7ebc
8 changed files with 146 additions and 3 deletions

View File

@@ -997,6 +997,9 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
}
}
session().data().reactions().poll(item, now);
if (item->hasExtendedMediaPreview()) {
session().api().views().pollExtendedMedia(item);
}
_reactionsManager->recordCurrentReactionEffect(
item->fullId(),
QPoint(0, top));

View File

@@ -1169,6 +1169,15 @@ bool HistoryItem::isRegular() const {
return isHistoryEntry() && !isLocal();
}
bool HistoryItem::hasExtendedMediaPreview() const {
if (const auto media = _media.get()) {
if (const auto invoice = media->invoice()) {
return (invoice->extendedPreview && !invoice->extendedMedia);
}
}
return false;
}
void HistoryItem::sendFailed() {
Expects(_flags & MessageFlag::BeingSent);
Expects(!(_flags & MessageFlag::SendingFailed));

View File

@@ -239,6 +239,7 @@ public:
[[nodiscard]] virtual bool externalReply() const {
return false;
}
[[nodiscard]] bool hasExtendedMediaPreview() const;
[[nodiscard]] virtual MsgId repliesInboxReadTill() const {
return MsgId(0);

View File

@@ -917,7 +917,7 @@ void HistoryMessageReplyMarkup::updateData(
bool HistoryMessageReplyMarkup::hiddenBy(Data::Media *media) const {
if (media && (data.flags & ReplyMarkupFlag::OnlyBuyButton)) {
if (const auto invoice = media->invoice()) {
if (!invoice->extendedPreview.dimensions.isEmpty()
if (invoice->extendedPreview
&& (!invoice->extendedMedia || !invoice->receiptMsgId)) {
return true;
}