mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Improved labels for channel and group types with restricted content.
This commit is contained in:
parent
26ba7e57ce
commit
48e3802565
2 changed files with 21 additions and 6 deletions
|
@ -1522,8 +1522,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_manage_peer_link_invite" = "Invite link";
|
||||
"lng_manage_peer_link_expired" = "Expired link";
|
||||
"lng_manage_private_group_title" = "Private";
|
||||
"lng_manage_private_group_noforwards_title" = "Private restricted";
|
||||
"lng_manage_public_group_title" = "Public";
|
||||
"lng_manage_private_peer_title" = "Private";
|
||||
"lng_manage_private_peer_noforwards_title" = "Private restricted";
|
||||
"lng_manage_public_peer_title" = "Public";
|
||||
"lng_manage_peer_send_title" = "Who can send new messages?";
|
||||
"lng_manage_peer_send_only_members" = "Only members";
|
||||
|
|
|
@ -415,7 +415,12 @@ private:
|
|||
std::deque<FnMut<void()>> _saveStagesQueue;
|
||||
Saving _savingData;
|
||||
|
||||
const rpl::event_stream<Privacy> _privacyTypeUpdates;
|
||||
struct PrivacyAndForwards {
|
||||
Privacy privacy;
|
||||
bool noForwards = false;
|
||||
};
|
||||
|
||||
const rpl::event_stream<PrivacyAndForwards> _privacyTypeUpdates;
|
||||
const rpl::event_stream<ChannelData*> _linkedChatUpdates;
|
||||
mtpRequestId _linkedChatsRequestId = 0;
|
||||
|
||||
|
@ -761,7 +766,7 @@ void Controller::refreshHistoryVisibility() {
|
|||
void Controller::showEditPeerTypeBox(
|
||||
std::optional<rpl::producer<QString>> error) {
|
||||
const auto boxCallback = crl::guard(this, [=](EditPeerTypeData data) {
|
||||
_privacyTypeUpdates.fire_copy(data.privacy);
|
||||
_privacyTypeUpdates.fire({ data.privacy, data.noForwards });
|
||||
_typeDataSavedValue = data;
|
||||
refreshHistoryVisibility();
|
||||
});
|
||||
|
@ -882,7 +887,8 @@ void Controller::fillPrivacyTypeButton() {
|
|||
? tr::lng_manage_peer_group_type
|
||||
: tr::lng_manage_peer_channel_type)(),
|
||||
_privacyTypeUpdates.events(
|
||||
) | rpl::map([=](Privacy flag) {
|
||||
) | rpl::map([=](PrivacyAndForwards data) {
|
||||
const auto flag = data.privacy;
|
||||
if (flag == Privacy::HasUsername) {
|
||||
_peer->session().api().usernames().requestToCache(_peer);
|
||||
}
|
||||
|
@ -894,14 +900,21 @@ void Controller::fillPrivacyTypeButton() {
|
|||
: tr::lng_manage_public_peer_title)()
|
||||
: (hasLocation
|
||||
? tr::lng_manage_peer_link_invite
|
||||
: isGroup
|
||||
: ((!data.noForwards) && isGroup)
|
||||
? tr::lng_manage_private_group_title
|
||||
: tr::lng_manage_private_peer_title)();
|
||||
: ((!data.noForwards) && !isGroup)
|
||||
? tr::lng_manage_private_peer_title
|
||||
: isGroup
|
||||
? tr::lng_manage_private_group_noforwards_title
|
||||
: tr::lng_manage_private_peer_noforwards_title)();
|
||||
}) | rpl::flatten_latest(),
|
||||
[=] { showEditPeerTypeBox(); },
|
||||
{ &st::menuIconCustomize });
|
||||
|
||||
_privacyTypeUpdates.fire_copy(_typeDataSavedValue->privacy);
|
||||
_privacyTypeUpdates.fire_copy({
|
||||
_typeDataSavedValue->privacy,
|
||||
_typeDataSavedValue->noForwards,
|
||||
});
|
||||
}
|
||||
|
||||
void Controller::fillLinkedChatButton() {
|
||||
|
|
Loading…
Add table
Reference in a new issue