From 31e26a7004d90e2d29055d8238945244be71d1c7 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 28 Aug 2019 00:43:48 +0300 Subject: [PATCH] Delete message files in all chats. GitOrigin-RevId: 34981a807b217e657ff656940117ae9b38936fb9 --- td/telegram/MessagesManager.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index b5d7133e..7ab9e31a 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -23991,8 +23991,13 @@ bool MessagesManager::need_delete_file(FullMessageId full_message_id, FileId fil } bool MessagesManager::need_delete_message_files(Dialog *d, const Message *m) const { + if (m == nullptr) { + return false; + } + CHECK(d != nullptr); - if (m == nullptr || !m->message_id.is_server()) { + auto dialog_type = d->dialog_id.get_type(); + if (!m->message_id.is_server() && dialog_type != DialogType::SecretChat) { return false; } @@ -24006,8 +24011,7 @@ bool MessagesManager::need_delete_message_files(Dialog *d, const Message *m) con } } - auto dialog_type = d->dialog_id.get_type(); - return dialog_type == DialogType::User || dialog_type == DialogType::SecretChat; + return true; } void MessagesManager::delete_message_from_database(Dialog *d, MessageId message_id, const Message *m,