From 56555c330b78d4efdcd0a24a4fe725255f607b1e Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 21 Aug 2023 12:06:20 +0200 Subject: [PATCH] Don't cancel admin log files download on item destroy. --- Telegram/SourceFiles/data/data_download_manager.cpp | 11 +++++++---- Telegram/SourceFiles/history/history.cpp | 10 ++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/data/data_download_manager.cpp b/Telegram/SourceFiles/data/data_download_manager.cpp index c1a0719feb..eaf1248310 100644 --- a/Telegram/SourceFiles/data/data_download_manager.cpp +++ b/Telegram/SourceFiles/data/data_download_manager.cpp @@ -833,11 +833,14 @@ void DownloadManager::cancel( SessionData &data, std::vector::iterator i) { const auto object = i->object; + const auto item = object.item; remove(data, i); - if (const auto document = object.document) { - document->cancel(); - } else if (const auto photo = object.photo) { - photo->cancel(); + if (!item->isAdminLogEntry()) { + if (const auto document = object.document) { + document->cancel(); + } else if (const auto photo = object.photo) { + photo->cancel(); + } } } diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index fe5a1a41e0..5b75925d8e 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -495,8 +495,10 @@ void History::destroyMessage(not_null item) { session().api().cancelLocalItem(item); } - const auto document = [&] { - const auto media = item->media(); + const auto documentToCancel = [&] { + const auto media = item->isAdminLogEntry() + ? nullptr + : item->media(); return media ? media->document() : nullptr; }(); @@ -510,8 +512,8 @@ void History::destroyMessage(not_null item) { Assert(i != end(_messages)); _messages.erase(i); - if (document) { - session().data().documentMessageRemoved(document); + if (documentToCancel) { + session().data().documentMessageRemoved(documentToCancel); } }