From 4896509ddf1bb473d1753a91a8bc377ab9b95bc7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 15 Feb 2021 14:58:01 +0400 Subject: [PATCH] Allow clear history for everyone in small supergroups. --- Telegram/SourceFiles/boxes/confirm_box.cpp | 2 -- Telegram/SourceFiles/data/data_histories.cpp | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index 5d5982b4a..b2174236e 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -748,8 +748,6 @@ auto DeleteMessagesBox::revokeText(not_null peer) const tr::now, lt_user, user->firstName); - } else if (_wipeHistoryJustClear) { - return std::nullopt; } else { result.checkbox = tr::lng_delete_for_everyone_check(tr::now); } diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index 5c7ccff83..47f388fd5 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -595,7 +595,7 @@ void Histories::deleteAllMessages( }; const auto chat = peer->asChat(); const auto channel = peer->asChannel(); - if (revoke && channel && channel->canDelete()) { + if (!justClear && revoke && channel && channel->canDelete()) { return session().api().request(MTPchannels_DeleteChannel( channel->inputChannel )).done([=](const MTPUpdates &result) { @@ -606,8 +606,11 @@ void Histories::deleteAllMessages( // } }).send(); } else if (channel) { + const auto flags = revoke + ? MTPchannels_DeleteHistory::Flag::f_for_everyone + : MTPchannels_DeleteHistory::Flag(0); return session().api().request(MTPchannels_DeleteHistory( - MTP_flags(0), + MTP_flags(flags), channel->inputChannel, MTP_int(deleteTillId) )).done([=](const MTPBool &result) {