Add community chats directly for community admins

This commit is contained in:
John Preston
2026-07-01 12:00:41 +04:00
parent 8f944fba8d
commit ce72f2e69f
2 changed files with 16 additions and 7 deletions
+1
View File
@@ -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";
@@ -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));
}