From ce72f2e69f749fc0ffff1ea67aee5ebb0056f839 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 1 Jul 2026 12:00:41 +0400 Subject: [PATCH] Add community chats directly for community admins --- Telegram/Resources/langs/lang.strings | 1 + .../boxes/peers/add_to_community_box.cpp | 22 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 036a4dda50..80837965c3 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2227,6 +2227,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_community_add_confirm" = "If this group is approved by a community admin, its members will be able to join or request to join other chats in the community."; "lng_community_add_confirm_add" = "Add"; "lng_community_add_done" = "Group added to the community."; +"lng_community_add_done_channel" = "Channel added to the community."; "lng_community_request_sent" = "Your request was sent to the community admins."; "lng_community_manage_name" = "Community name"; "lng_community_manage_who_add" = "Who can add chats"; diff --git a/Telegram/SourceFiles/boxes/peers/add_to_community_box.cpp b/Telegram/SourceFiles/boxes/peers/add_to_community_box.cpp index e933ac0380..586505728a 100644 --- a/Telegram/SourceFiles/boxes/peers/add_to_community_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_to_community_box.cpp @@ -245,7 +245,9 @@ void ShowAddPeerToCommunity( visible, [=] { show->hideLayer(); - show->showToast(tr::lng_community_add_done(tr::now)); + show->showToast(group->isBroadcast() + ? tr::lng_community_add_done_channel(tr::now) + : tr::lng_community_add_done(tr::now)); }, [=](const QString &error) { if (error == Api::kCommunityRequestCreated.utf16()) { @@ -264,12 +266,18 @@ void ShowAddPeerToCommunity( } }); }; - show->showBox(Ui::MakeConfirmBox({ - .text = tr::lng_community_add_confirm(), - .confirmed = sure, - .confirmText = tr::lng_community_add_confirm_add(), - .title = tr::lng_community_add_to(), - })); + // A community admin adds chats directly; everyone else can only + // suggest a chat, which a community admin must then approve. + if (community->canManageLinkedPeers()) { + sure([] {}); + } else { + show->showBox(Ui::MakeConfirmBox({ + .text = tr::lng_community_add_confirm(), + .confirmed = sure, + .confirmText = tr::lng_community_add_confirm_add(), + .title = tr::lng_community_add_to(), + })); + } }; show->showBox(Box(ChooseVisibilityBox, add)); }