From fd26e1618c2e868638734c3d5eeeb89dabb53ff2 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 29 Nov 2024 17:07:51 +0400 Subject: [PATCH] Add "Affiliate programs" to Manage Channel. --- Telegram/Resources/langs/lang.strings | 1 + .../boxes/peers/edit_peer_info_box.cpp | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index b1dff0aa6..95f1fa240 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1545,6 +1545,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_manage_channel_title" = "Manage Channel"; "lng_manage_bot_title" = "Manage Bot"; "lng_manage_peer_recent_actions" = "Recent actions"; +"lng_manage_peer_star_ref" = "Affiliate programs"; "lng_manage_peer_members" = "Members"; "lng_manage_peer_subscribers" = "Subscribers"; "lng_manage_peer_administrators" = "Administrators"; diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index 757dc01e4..b33b92af9 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -46,6 +46,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_user.h" #include "history/admin_log/history_admin_log_section.h" #include "info/bot/earn/info_bot_earn_widget.h" +#include "info/bot/starref/info_bot_starref_join_widget.h" #include "info/bot/starref/info_bot_starref_setup_widget.h" #include "info/channel_statistics/boosts/info_boosts_widget.h" #include "info/channel_statistics/earn/earn_format.h" @@ -1241,6 +1242,7 @@ void Controller::fillManageSection() { && (channel->isBroadcast() || channel->isGigagroup()); const auto hasRecentActions = isChannel && (channel->hasAdminRights() || channel->amCreator()); + const auto hasStarRef = isChannel && channel->canPostMessages(); const auto canEditStickers = isChannel && channel->canEditStickers(); const auto canDeleteChannel = isChannel && channel->canDelete(); const auto canEditColorIndex = isChannel && channel->canEditEmoji(); @@ -1423,10 +1425,21 @@ void Controller::fillManageSection() { AddButtonWithCount( _controls.buttonsLayout, tr::lng_manage_peer_recent_actions(), - rpl::single(QString()), //Empty count. + rpl::single(QString()), // Empty count. std::move(callback), { &st::menuIconGroupLog }); } + if (hasStarRef) { + auto callback = [=] { + _navigation->showSection(Info::BotStarRef::Join::Make(_peer)); + }; + AddButtonWithCount( + _controls.buttonsLayout, + tr::lng_manage_peer_star_ref(), + rpl::single(QString()), // Empty count. + std::move(callback), + { &st::menuIconSharing }); + } if (canEditStickers || canDeleteChannel) { ::AddSkip(_controls.buttonsLayout);