diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index e74d0e793..47b693e36 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -188,8 +188,6 @@ PRIVATE boxes/peers/edit_peer_invite_link.h boxes/peers/edit_peer_invite_links.cpp boxes/peers/edit_peer_invite_links.h - boxes/peers/edit_peer_history_visibility_box.cpp - boxes/peers/edit_peer_history_visibility_box.h boxes/peers/edit_peer_permissions_box.cpp boxes/peers/edit_peer_permissions_box.h boxes/peers/edit_peer_reactions.cpp diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp index 338e1f724..697066416 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp @@ -7,9 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "boxes/peers/edit_peer_history_visibility_box.h" -#include "data/data_channel.h" -#include "data/data_chat.h" -#include "data/data_peer.h" #include "lang/lang_keys.h" #include "ui/layers/generic_box.h" #include "ui/widgets/checkbox.h" @@ -19,13 +16,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL void EditPeerHistoryVisibilityBox( not_null box, - not_null peer, + bool isLegacy, Fn savedCallback, HistoryVisibility historyVisibilitySavedValue) { const auto historyVisibility = std::make_shared< Ui::RadioenumGroup >(historyVisibilitySavedValue); - peer->updateFull(); box->setTitle(tr::lng_manage_history_visibility_title()); box->addButton(tr::lng_settings_save(), [=] { @@ -34,18 +30,6 @@ void EditPeerHistoryVisibilityBox( }); box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); - const auto canEdit = [&] { - if (const auto chat = peer->asChat()) { - return chat->canEditPreHistoryHidden(); - } else if (const auto channel = peer->asChannel()) { - return channel->canEditPreHistoryHidden(); - } - Unexpected("User in HistoryVisibilityEdit."); - }(); - if (!canEdit) { - return; - } - box->addSkip(st::editPeerHistoryVisibilityTopSkip); box->addRow(object_ptr>( box, @@ -70,7 +54,7 @@ void EditPeerHistoryVisibilityBox( box->addRow( object_ptr( box, - (peer->isChat() + (isLegacy ? tr::lng_manage_history_visibility_hidden_legacy : tr::lng_manage_history_visibility_hidden_about)(), st::editPeerPrivacyLabel), diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.h b/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.h index 5dcd1f794..2ef046cb2 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.h +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.h @@ -18,6 +18,6 @@ enum class HistoryVisibility { void EditPeerHistoryVisibilityBox( not_null box, - not_null peer, + bool isLegacy, Fn savedCallback, HistoryVisibility historyVisibilitySavedValue); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index fe1f5d452..84e9bd316 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -837,9 +837,21 @@ void Controller::fillHistoryVisibilityButton() { _historyVisibilitySavedValue = checked; }); const auto buttonCallback = [=] { + _peer->updateFull(); + const auto canEdit = [&] { + if (const auto chat = _peer->asChat()) { + return chat->canEditPreHistoryHidden(); + } else if (const auto channel = _peer->asChannel()) { + return channel->canEditPreHistoryHidden(); + } + Unexpected("User in HistoryVisibilityEdit."); + }(); + if (!canEdit) { + return; + } _navigation->parentController()->show(Box( EditPeerHistoryVisibilityBox, - _peer, + _peer->isChat(), boxCallback, *_historyVisibilitySavedValue)); }; diff --git a/Telegram/cmake/td_ui.cmake b/Telegram/cmake/td_ui.cmake index ab15739d5..ceb03b6bc 100644 --- a/Telegram/cmake/td_ui.cmake +++ b/Telegram/cmake/td_ui.cmake @@ -48,6 +48,9 @@ nice_target_sources(td_ui ${src_loc} PRIVATE ${style_files} + boxes/peers/edit_peer_history_visibility_box.cpp + boxes/peers/edit_peer_history_visibility_box.h + calls/group/ui/calls_group_recording_box.cpp calls/group/ui/calls_group_recording_box.h calls/group/ui/calls_group_scheduled_labels.cpp