diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp index e6d227278..132b3e3c8 100644 --- a/Telegram/SourceFiles/history/history_service.cpp +++ b/Telegram/SourceFiles/history/history_service.cpp @@ -768,9 +768,9 @@ HistoryService::PreparedText HistoryService::preparePaymentSentText() { return textcmdLink(1, invoice->title); } } - return tr::lng_deleted_message(tr::now); + return QString();// tr::lng_deleted_message(tr::now); } else if (payment->msgId) { - return tr::lng_contacts_loading(tr::now); + return QString();// tr::lng_contacts_loading(tr::now); } return QString(); }(); @@ -1062,7 +1062,10 @@ void HistoryService::createFromMtp(const MTPDmessageService &message) { dependent->msgId = data.vreply_to_msg_id().v; if (!updateDependent()) { history()->session().api().requestMessageData( - history()->peer->asChannel(), + (peerIsChannel(dependent->peerId) + ? history()->owner().channel( + peerToChannel(dependent->peerId)).get() + : history()->peer->asChannel()), dependent->msgId, HistoryDependentItemCallback(this)); } @@ -1139,11 +1142,20 @@ void HistoryService::updateText(PreparedText &&text) { void HistoryService::clearDependency() { if (const auto dependent = GetDependentData()) { if (dependent->msg) { - history()->owner().unregisterDependentMessage(this, dependent->msg); + history()->owner().unregisterDependentMessage( + this, + dependent->msg); + dependent->msg = nullptr; + dependent->msgId = 0; } } } +void HistoryService::dependencyItemRemoved(HistoryItem *dependency) { + clearDependency(); + updateDependentText(); +} + HistoryService::~HistoryService() { clearDependency(); _media.reset(); diff --git a/Telegram/SourceFiles/history/history_service.h b/Telegram/SourceFiles/history/history_service.h index 1f7c4854d..e7bb8ee70 100644 --- a/Telegram/SourceFiles/history/history_service.h +++ b/Telegram/SourceFiles/history/history_service.h @@ -103,6 +103,8 @@ public: Storage::SharedMediaTypesMask sharedMediaTypes() const override; + void dependencyItemRemoved(HistoryItem *dependency) override; + bool needCheck() const override; bool serviceMsg() const override { return true; diff --git a/Telegram/SourceFiles/payments/payments_checkout_process.cpp b/Telegram/SourceFiles/payments/payments_checkout_process.cpp index ff8692009..376e3b36d 100644 --- a/Telegram/SourceFiles/payments/payments_checkout_process.cpp +++ b/Telegram/SourceFiles/payments/payments_checkout_process.cpp @@ -155,7 +155,6 @@ void CheckoutProcess::handleFormUpdate(const FormUpdate &update) { _session->api().applyUpdates(data.updates); if (weak) { closeAndReactivate(); - if (_reactivate) _reactivate(); } }, [&](const Error &error) { handleError(error); diff --git a/Telegram/SourceFiles/payments/payments_form.cpp b/Telegram/SourceFiles/payments/payments_form.cpp index 62c671a8c..63597878e 100644 --- a/Telegram/SourceFiles/payments/payments_form.cpp +++ b/Telegram/SourceFiles/payments/payments_form.cpp @@ -116,8 +116,8 @@ void Form::fillInvoiceFromMessage() { if (const auto item = _session->data().message(id)) { const auto media = [&] { if (const auto payment = item->Get()) { - if (payment->msg) { - return payment->msg->media(); + if (const auto invoice = payment->msg) { + return invoice->media(); } } return item->media(); @@ -346,6 +346,20 @@ void Form::processDetails(const MTPDpayments_paymentReceipt &data) { .botId = data.vbot_id().v, .providerId = data.vprovider_id().v, }; + if (_invoice.cover.title.isEmpty() + && _invoice.cover.description.isEmpty() + && _invoice.cover.thumbnail.isNull() + && !_thumbnailLoadProcess) { + _invoice.cover = Ui::Cover{ + .title = qs(data.vtitle()), + .description = qs(data.vdescription()), + }; + if (const auto web = data.vphoto()) { + if (const auto photo = _session->data().photoFromWeb(*web, {})) { + loadThumbnail(photo); + } + } + } if (_details.botId) { if (const auto bot = _session->data().userLoaded(_details.botId)) { _invoice.cover.seller = bot->name;