From 0a678ae8bdf512038e2bc1293ed66462c3ea30b8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 19 Feb 2021 14:18:13 +0400 Subject: [PATCH] No 'Clear History' for everyone in groups. --- Telegram/Resources/tl/api.tl | 2 +- Telegram/SourceFiles/boxes/confirm_box.cpp | 2 ++ Telegram/SourceFiles/data/data_histories.cpp | 4 ---- Telegram/SourceFiles/window/window_peer_menu.cpp | 8 ++++---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Telegram/Resources/tl/api.tl b/Telegram/Resources/tl/api.tl index 1a6e752086..01457d6b91 100644 --- a/Telegram/Resources/tl/api.tl +++ b/Telegram/Resources/tl/api.tl @@ -1568,7 +1568,7 @@ channels.editBanned#72796912 channel:InputChannel user_id:InputUser banned_right channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector max_id:long min_id:long limit:int = channels.AdminLogResults; channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool; channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool; -channels.deleteHistory#bda41f3f flags:# for_everyone:flags.0?true channel:InputChannel max_id:int = Bool; +channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; channels.getGroupsForDiscussion#f5dad378 = messages.Chats; diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index f2b12f4bd5..3828af9e45 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -750,6 +750,8 @@ 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 47f388fd5d..6c9eacc2af 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -606,11 +606,7 @@ 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(flags), channel->inputChannel, MTP_int(deleteTillId) )).done([=](const MTPBool &result) { diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 95e891f7ab..4efeba6a16 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -583,16 +583,16 @@ void Filler::addChannelActions(not_null channel) { } } if (channel->amIn()) { + auto text = isGroup + ? tr::lng_profile_leave_group(tr::now) + : tr::lng_profile_leave_channel(tr::now); + _addAction(text, DeleteAndLeaveHandler(channel)); if ((isGroup && !channel->isPublic()) || channel->canDeleteMessages()) { _addAction( tr::lng_profile_clear_history(tr::now), ClearHistoryHandler(channel)); } - auto text = isGroup - ? tr::lng_profile_leave_group(tr::now) - : tr::lng_profile_leave_channel(tr::now); - _addAction(text, DeleteAndLeaveHandler(channel)); } else { auto text = isGroup ? tr::lng_profile_join_group(tr::now)