From d67a5dc5109e76593ec224e3b3a37a224abbc49b Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 16 Feb 2021 20:26:58 +0400 Subject: [PATCH] Remove messages ttl edit from Manage Channel. --- .../boxes/peers/edit_peer_info_box.cpp | 44 +------------------ 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index 9abba406c6..4c81c27978 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -29,7 +29,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "data/data_changes.h" #include "history/admin_log/history_admin_log_section.h" -#include "history/view/controls/history_view_ttl_button.h" #include "info/profile/info_profile_values.h" #include "lang/lang_keys.h" #include "mainwidget.h" @@ -337,7 +336,6 @@ private: //void fillInviteLinkButton(); void fillSignaturesButton(); void fillHistoryVisibilityButton(); - void fillSetMessagesTTLButton(); void fillManageSection(); void submitTitle(); @@ -883,35 +881,6 @@ void Controller::fillHistoryVisibilityButton() { refreshHistoryVisibility(); } -void Controller::fillSetMessagesTTLButton() { - Expects(_controls.buttonsLayout != nullptr); - - auto label = _peer->session().changes().peerFlagsValue( - _peer, - Data::PeerUpdate::Flag::MessagesTTL - ) | rpl::map([=] { - const auto period = _peer->messagesTTL(); - return !period - ? tr::lng_manage_messages_ttl_never() - : (period == 5) // for debugging - ? rpl::single("5 seconds") // for debugging - : (period < 3 * 86400) - ? tr::lng_manage_messages_ttl_after1() - : tr::lng_manage_messages_ttl_after2(); - }) | rpl::flatten_latest(); - - const auto buttonCallback = [=] { - Ui::show( - Box(HistoryView::Controls::AutoDeleteSettingsBox, _peer), - Ui::LayerOption::KeepOther); - }; - AddButtonWithText( - _controls.buttonsLayout, - tr::lng_manage_messages_ttl_title(), - std::move(label), - buttonCallback); -} - void Controller::fillManageSection() { Expects(_controls.buttonsLayout != nullptr); @@ -935,13 +904,6 @@ void Controller::fillManageSection() { ? channel->canEditPreHistoryHidden() : chat->canEditPreHistoryHidden(); }(); - const auto canSetMessagesTTL = [&] { - // Leave this entry point only for channels for now. - // Groups and users have their entry point in 'Clear History' box. - return isChannel - && !channel->isMegagroup() - && channel->canDeleteMessages(); - }(); const auto canEditPermissions = [&] { return isChannel @@ -1007,9 +969,6 @@ void Controller::fillManageSection() { if (canEditPreHistoryHidden) { fillHistoryVisibilityButton(); } - if (canSetMessagesTTL) { - fillSetMessagesTTLButton(); - } if (canEditSignatures) { fillSignaturesButton(); } @@ -1017,8 +976,7 @@ void Controller::fillManageSection() { || canEditSignatures //|| canEditInviteLinks || canViewOrEditLinkedChat - || canEditUsername - || canSetMessagesTTL) { + || canEditUsername) { AddSkip( _controls.buttonsLayout, st::editPeerTopButtonsLayoutSkip,