From 08eafe8a938be1601f610682f0b23a9f50a192cc Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sun, 11 Sep 2022 05:38:05 +0300 Subject: [PATCH] [Improvement] Show group manage buttons in profile --- .../info/edit/group_manage_permissions.png | Bin 0 -> 677 bytes .../info/edit/group_manage_permissions@2x.png | Bin 0 -> 1418 bytes .../info/edit/group_manage_permissions@3x.png | Bin 0 -> 1911 bytes .../Resources/icons/info/info_blacklist.png | Bin 0 -> 457 bytes .../icons/info/info_blacklist@2x.png | Bin 0 -> 991 bytes .../icons/info/info_blacklist@3x.png | Bin 0 -> 1462 bytes .../boxes/peers/edit_peer_info_box.cpp | 5 +- .../boxes/peers/edit_peer_info_box.h | 7 + .../info/profile/info_profile_actions.cpp | 190 ++++++++++++++++++ .../info/profile/info_profile_actions.h | 5 + .../profile/info_profile_inner_widget.cpp | 4 + Telegram/SourceFiles/mainwidget.cpp | 6 + Telegram/SourceFiles/mainwidget.h | 1 + 13 files changed, 215 insertions(+), 3 deletions(-) create mode 100644 Telegram/Resources/icons/info/edit/group_manage_permissions.png create mode 100644 Telegram/Resources/icons/info/edit/group_manage_permissions@2x.png create mode 100644 Telegram/Resources/icons/info/edit/group_manage_permissions@3x.png create mode 100644 Telegram/Resources/icons/info/info_blacklist.png create mode 100644 Telegram/Resources/icons/info/info_blacklist@2x.png create mode 100644 Telegram/Resources/icons/info/info_blacklist@3x.png diff --git a/Telegram/Resources/icons/info/edit/group_manage_permissions.png b/Telegram/Resources/icons/info/edit/group_manage_permissions.png new file mode 100644 index 0000000000000000000000000000000000000000..bcf7f45674a60625a864d2caf7d6f507c18a6f41 GIT binary patch literal 677 zcmV;W0$TlvP)Px#1ZP1_K>z@;j|==^1poj6HBd}cMF0Q*0RaIU8yhMrDjgji0s;aA1O!-ESk2AN z^Yioc^z_lu(PU&~1qB71oScJ$gE28N92^`jE-rk0eD3bS!IxsLWot>SRmzQ#Ka*>gd^78UdPEJrzP$3~9 zs;a6zJv}uwHRt<8010qNS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Vm!9)2xy(tCO`U?o6ewSxcv_(~=7TtWRg; z8JSQfZP=*8oAglp*_?$E4Mr$#**OwnC;Y!yjx*f32Q_h{o7kVIjGdg;0bU`0952NNHs_%#5O?~My?YyETXGJ~r z1B_P(kYWIKi#N0B8jiYtgDp23Z}knjgMfd##&+kfi%fl}hlXvUdm3o>WgV8B*wB#& z4Ejb$II+xN^8mMt%G{U>o*m+$!gH^1zsoq+~bTmd@{{sHJ8&5Nl z5Ywf=blt@J52OV)lmu_k+wsTPkx!q$kQP|&SQTziXcWX{r~!mf5PMa Y0f@+xoXbnvLI3~&07*qoM6N<$f>l(XYXATM literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/info/edit/group_manage_permissions@3x.png b/Telegram/Resources/icons/info/edit/group_manage_permissions@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..894504ae30f120e04e3d3d9ebe2959f1bb66d39f GIT binary patch literal 1911 zcmV--2Z;EIP)Px#1ZP1_K>z@;j|==^1poj7j!;ZgMF0Q*3kwT0G&EIJRcL5vczAe)g@t{6eQIiI zSy@>2L}fyCnt}OkN5ZY{r&y_|Nraj>#VG-J3BiJ3=AJ1AA5Uy;o;%_{{H#- z`QYH-@$vDQnVBUeB`ho~rlzLa+S;$LuY-ewX=!O#SXfLFMb}KtLlSBe1Zr-QC?`VPOae2t`FjEiEk%4-bori`UoJQ&UsT&CRv7 zwdd#OUteEGM@RMb^@fIq2?+^iW@f>`!P3&w7#J8978atSqV)9iVq#(h1OzB3C_X+u zNl8iG-rlpbvmhWK#l^*BWMss|#O3AXs;a6&LPAhbP!0|bO-)VXA|k@V z!tCtq+}zxek&!7WDbdl!cJlJ_ z@9*!8jg5(kiGhKEIyyQU8XB~;w4tG)6ciLBBqX4qprfOsCMG6eU|_Mav5Ja{l9G}f z92~8!tyWf6JUl$`@bJgS$4g5~FfcG)US5KNf^u?le}8|Pnwp!Nn`>)p$;ru=mzNnC z8OFxOd3kx?-``_nV{UG4Qc_ZApsbFQwgPft%PD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r|5_==#v<@bAITryG>d8 x@xNz_>NEMtcMsHz^$!mVRQ_qE`5(bB{{VLL8&>RHtGoaJ002ovPDHLkV1n+?mu&z5 literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/info/info_blacklist.png b/Telegram/Resources/icons/info/info_blacklist.png new file mode 100644 index 0000000000000000000000000000000000000000..6fabfff9695e421276bab3f15175d00bfdcebd57 GIT binary patch literal 457 zcmV;)0XF`LP)Px#1ZP1_K>z@;j|==^1poj5nNUnrMF0Q*ARr(VGd006m3 zL_t(2Q?*go62c%5JRpQ_VvN1_UjP5&G(Zf_m?y`5x!pbH8t@k&jFG1SNJL}CVj2-| zcyJ+=HbyHcxVJ2LBS{@gn^}+{qV$2Zn5e2nvh;J=?#Rds0IEFc_WA=*)GI)-c4Rmj zPXKgWPK}wdF`v#}J{X3rd?)6M<*JBP!j)QYwmU1UQnva2aCCmqycidq&KD=rU|b@u z^mcbVO@al1XOHrI()c`9%@OO*Uf}yj{S1I7*bE5R$~x8b00000NkvXXu0mjfDH6Q5 literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/info/info_blacklist@2x.png b/Telegram/Resources/icons/info/info_blacklist@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..e05e0362dbe71017fcf95df2fd889f2113222b8f GIT binary patch literal 991 zcmV<510ei~P)Px#1ZP1_K>z@;j|==^1poj6R!~e-MF0Q*EG#TkR8)0!b%TS00RaIT8X8GSNt&9P z-{0T=|NjUG2sk)6tE;Qzg*p zUf9^!{QUeqJw46M&8@AiWMpLF;oFMdIsi`e3Ed~Y#fq{V)6%}A$U=I%uhlhvo@bL5V^P!=kZEbDt?(UwR zo(c*Ijg5_>qM{HG5NvF0pP!#5CMJrCiXzO#>=+1c5FIpn`l zV7X$EV+$z%3STN$1cC^aa*4-DFxJV6mc zIdrP5+Ear_*(y@Xnp_;e`)qIjdA18_7niig?u(c3YCUu%P+J3=@8Gqu{pM}tN}x7h z)ZPd0_Tl{pbj8ryd;EYtep>px_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?RpQu$JjGBt-^0JADRV=4=7w!8k6- zQW>v;)d`&mSv>D>?mRm1!o{*3CX(m`r*(U{8a4obl4Kd?OP2wzTrF0#q#wXm5#_L$ z$GSxKRKT^&9NM|Qv);Zg%ydfL*5RQBNS44_Zp5H8e{=WO0Pa&qvJ^c!Fi5hP;;q}0 zP`Yzhu!JBUjM4!&0JMcj7ExSSTmravU$~V}8$bieQkKzwDDlR-Pfz$Yc z)Lm2zmA591>q2rQ2F}%&r0$}&H3K?3Ofpf>y~2X>`VFZ9)SO-A_}AW|op~ zDy}D*$Z9tc+ieY(=Squ;buyP2=C#|JN~6VbTMF@mcE+-Jp4yETwSG(g-}<4Y8a1Oh zYmM4tNyEN^ZarYbjv+31LfFbr2;0G)5J-(4HAtregisterModifyRequest(key, requestId); } +} // namespace + void ShowEditPermissions( not_null navigation, not_null peer) { @@ -2262,9 +2264,6 @@ void Controller::deleteChannel() { }).send(); } -} // namespace - - EditPeerInfoBox::EditPeerInfoBox( QWidget*, not_null navigation, diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.h b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.h index 9844320cf..0858375a2 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.h +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.h @@ -26,6 +26,13 @@ class VerticalLayout; class SettingsButton; } // namespace Ui +void ShowEditPermissions( + not_null navigation, + not_null peer); +void ShowEditInviteLinks( + not_null navigation, + not_null peer); + class EditPeerInfoBox : public Ui::BoxContent { public: EditPeerInfoBox( diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index c9738c19b..0d44901dd 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -17,6 +17,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/unixtime.h" #include "boxes/peers/add_bot_to_chat_box.h" #include "boxes/peers/edit_contact_box.h" +#include "boxes/peers/edit_peer_info_box.h" +#include "boxes/peers/edit_peer_invite_links.h" +#include "boxes/peers/edit_participants_box.h" #include "boxes/report_messages_box.h" #include "boxes/share_box.h" #include "boxes/translate_box.h" @@ -40,6 +43,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_item_helpers.h" #include "history/view/history_view_context_menu.h" // HistoryView::ShowReportPeerBox #include "history/view/history_view_item_preview.h" +#include "history/admin_log/history_admin_log_section.h" #include "info/info_controller.h" #include "info/info_memento.h" #include "info/profile/info_profile_icon.h" @@ -70,6 +74,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/wrap/vertical_layout.h" #include "window/window_controller.h" // Window::Controller::show. #include "window/window_peer_menu.h" +#include "mainwidget.h" #include "window/window_session_controller.h" #include "styles/style_info.h" #include "styles/style_layers.h" @@ -840,6 +845,31 @@ private: }; +class ManageFiller { +public: + ManageFiller( + not_null controller, + not_null parent, + not_null peer); + + object_ptr fill(); + +private: + void addPeerPermissions(not_null peer); + void addPeerAdmins(not_null peer); + void addPeerInviteLinks(not_null peer); + void addChannelBlockedUsers(not_null channel); + void addChannelRecentActions(not_null channel); + + void fillChatActions(not_null chat); + void fillChannelActions(not_null channel); + + not_null _controller; + not_null _parent; + not_null _peer; + object_ptr _wrap = { nullptr }; +}; + void ReportReactionBox( not_null box, not_null controller, @@ -2114,6 +2144,158 @@ object_ptr ActionsFiller::fill() { return { nullptr }; } +ManageFiller::ManageFiller( + not_null controller, + not_null parent, + not_null peer) +: _controller(controller) +, _parent(parent) +, _peer(peer) { +} + +void ManageFiller::addPeerPermissions( + not_null peer) { + if (peer->isUser() || (peer->isChannel() && !peer->isMegagroup())) return; + + const auto canEditPermissions = [&] { + return peer->isChannel() + ? peer->asChannel()->canEditPermissions() + : peer->asChat()->canEditPermissions(); + }(); + + if (canEditPermissions) { + const auto controller = _controller; + auto button = AddActionButton( + _wrap, + tr::lng_manage_peer_permissions(), + rpl::single(true), + [=] { ShowEditPermissions(controller->parentController(), peer); }, + &st::menuIconPermissions); + } +} + +void ManageFiller::addPeerAdmins( + not_null peer) { + if (peer->isUser()) return; + + const auto canViewAdmins = [&] { + return peer->isChannel() + ? peer->asChannel()->canViewAdmins() + : peer->asChat()->amIn(); + }(); + if (canViewAdmins) { + const auto controller = _controller; + auto button = AddActionButton( + _wrap, + tr::lng_manage_peer_administrators(), + rpl::single(true), + [=] { ParticipantsBoxController::Start( + controller->parentController(), + peer, + ParticipantsBoxController::Role::Admins);}, + &st::menuIconAdmin); + } +} + +void ManageFiller::addPeerInviteLinks( + not_null peer) { + if (peer->isUser()) return; + + const auto canHaveInviteLink = [&] { + return peer->isChannel() + ? peer->asChannel()->canHaveInviteLink() + : peer->asChat()->canHaveInviteLink(); + }(); + if (canHaveInviteLink) { + const auto controller = _controller->parentController(); + auto button = AddActionButton( + _wrap, + tr::lng_manage_peer_invite_links(), + rpl::single(true), + [=] { + controller->window().show(Box(ManageInviteLinksBox, peer, peer->session().user(), 0, 0), + Ui::LayerOption::KeepOther); + }, + &st::menuIconLinks); + } +} + +void ManageFiller::addChannelBlockedUsers( + not_null channel) { + if (channel->hasAdminRights() || channel->amCreator()) { + const auto controller = _controller; + auto button = AddActionButton( + _wrap, + tr::lng_manage_peer_removed_users(), + rpl::single(true), + [=] { ParticipantsBoxController::Start( + controller->parentController(), + channel, + ParticipantsBoxController::Role::Kicked);}, + &st::menuIconRemove); + } +} + +void ManageFiller::addChannelRecentActions( + not_null channel) { + if (channel->hasAdminRights() || channel->amCreator()) { + const auto controller = _controller; + auto button = AddActionButton( + _wrap, + tr::lng_manage_peer_recent_actions(), + rpl::single(true), + [=] { + if (const auto window = controller->parentController()) { + if (const auto mainwidget = window->widget()->sessionContent()) { + if (mainwidget->areRecentActionsOpened()) { + controller->showSection( + std::make_shared(channel)); + } + } + } + }, + &st::menuIconGroupLog); + } +} + +void ManageFiller::fillChatActions( + not_null chat) { + addPeerPermissions(chat); + addPeerAdmins(chat); + addPeerInviteLinks(chat); +} + +void ManageFiller::fillChannelActions( + not_null channel) { + addPeerPermissions(channel); + addPeerAdmins(channel); + addPeerInviteLinks(channel); + addChannelBlockedUsers(channel); + addChannelRecentActions(channel); +} + +object_ptr ManageFiller::fill() { + auto wrapResult = [=](auto &&callback) { + _wrap = object_ptr(_parent); + _wrap->add(CreateSkipWidget(_wrap)); + callback(); + _wrap->add(CreateSkipWidget(_wrap)); + return std::move(_wrap); + }; + if (auto chat = _peer->asChat()) { + return wrapResult([=] { + fillChatActions(chat); + }); + } else if (auto channel = _peer->asChannel()) { + if (channel->isMegagroup() || channel->hasAdminRights() || channel->amCreator()) { + return wrapResult([=] { + fillChannelActions(channel); + }); + } + } + return { nullptr }; +} + } // namespace const char kOptionShowPeerIdBelowAbout[] = "show-peer-id-below-about"; @@ -2135,6 +2317,14 @@ object_ptr SetupDetails( return filler.fill(); } +object_ptr SetupManage( + not_null controller, + not_null parent, + not_null peer) { + ManageFiller filler(controller, parent, peer); + return filler.fill(); +} + object_ptr SetupActions( not_null controller, not_null parent, diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.h b/Telegram/SourceFiles/info/profile/info_profile_actions.h index d31714a82..785deadf2 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.h +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.h @@ -38,6 +38,11 @@ object_ptr SetupDetails( not_null parent, not_null topic); +object_ptr SetupManage( + not_null controller, + not_null parent, + not_null peer); + object_ptr SetupActions( not_null controller, not_null parent, diff --git a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp index 92192d3b3..8b4a2e447 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp @@ -108,6 +108,10 @@ object_ptr InnerWidget::setupContent( } else { result->add(SetupDetails(_controller, parent, _peer, origin)); } + if (auto manage = SetupManage(_controller, result.data(), _peer)) { + result->add(object_ptr(result)); + result->add(std::move(manage)); + } result->add(setupSharedMedia(result.data())); if (_topic) { return result; diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index f7dbb4b7e..3c146da22 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -49,6 +49,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "dialogs/dialogs_widget.h" #include "history/history_widget.h" #include "history/history_item_helpers.h" // GetErrorTextForSending. +#include "history/admin_log/history_admin_log_section.h" #include "history/view/media/history_view_media.h" #include "history/view/history_view_service_message.h" #include "history/view/history_view_sublist_section.h" @@ -1942,6 +1943,11 @@ void MainWidget::showNonPremiumLimitToast(bool download) { }); } +bool MainWidget::areRecentActionsOpened() { + return _mainSection + && static_cast(_mainSection.data()); +} + void MainWidget::showBackFromStack( const SectionShow ¶ms) { if (preventsCloseSection([=] { showBackFromStack(params); }, params)) { diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index ff821e658..7758b1e59 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -236,6 +236,7 @@ public: void showNonPremiumLimitToast(bool download); + bool areRecentActionsOpened(); void dialogsCancelled(); private: