Replace "Members" with "Subscribers" in channel manage
This commit is contained in:
parent
dc13f5fb76
commit
2351d710b9
5 changed files with 30 additions and 15 deletions
|
|
@ -2313,5 +2313,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"ktg_outdated_now" = "So that Kotatogram Desktop can update to newer versions.";
|
"ktg_outdated_now" = "So that Kotatogram Desktop can update to newer versions.";
|
||||||
"ktg_mac_menu_show" = "Show Kotatogram";
|
"ktg_mac_menu_show" = "Show Kotatogram";
|
||||||
|
|
||||||
|
"ktg_manage_peer_subscribers" = "Subscribers";
|
||||||
|
|
||||||
// Keys finished
|
// Keys finished
|
||||||
|
|
|
||||||
|
|
@ -77,5 +77,6 @@
|
||||||
"ktg_language_not_ready_about": "К сожалению, в этом неофициальном переводе ({lang_name}) нет текстов приложения Kotatogram Desktop. Вы можете использовать {link}, чтобы помочь с переводом приложения.",
|
"ktg_language_not_ready_about": "К сожалению, в этом неофициальном переводе ({lang_name}) нет текстов приложения Kotatogram Desktop. Вы можете использовать {link}, чтобы помочь с переводом приложения.",
|
||||||
"ktg_outdated_soon": "Иначе приложение перестанет обновляться с {date}.",
|
"ktg_outdated_soon": "Иначе приложение перестанет обновляться с {date}.",
|
||||||
"ktg_outdated_now": "Чтобы приложение Kotatogram могло получать обновления.",
|
"ktg_outdated_now": "Чтобы приложение Kotatogram могло получать обновления.",
|
||||||
"ktg_mac_menu_show": "Показать Kotatogram"
|
"ktg_mac_menu_show": "Показать Kotatogram",
|
||||||
|
"ktg_manage_peer_subscribers": "Подписчики"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -517,6 +517,7 @@ UserData *ParticipantsAdditionalData::applyParticipant(
|
||||||
return data.match([&](const MTPDchannelParticipantCreator &data) {
|
return data.match([&](const MTPDchannelParticipantCreator &data) {
|
||||||
if (overrideRole != Role::Profile
|
if (overrideRole != Role::Profile
|
||||||
&& overrideRole != Role::Members
|
&& overrideRole != Role::Members
|
||||||
|
&& overrideRole != Role::Subscribers
|
||||||
&& overrideRole != Role::Admins) {
|
&& overrideRole != Role::Admins) {
|
||||||
return logBad();
|
return logBad();
|
||||||
}
|
}
|
||||||
|
|
@ -524,25 +525,29 @@ UserData *ParticipantsAdditionalData::applyParticipant(
|
||||||
}, [&](const MTPDchannelParticipantAdmin &data) {
|
}, [&](const MTPDchannelParticipantAdmin &data) {
|
||||||
if (overrideRole != Role::Profile
|
if (overrideRole != Role::Profile
|
||||||
&& overrideRole != Role::Members
|
&& overrideRole != Role::Members
|
||||||
|
&& overrideRole != Role::Subscribers
|
||||||
&& overrideRole != Role::Admins) {
|
&& overrideRole != Role::Admins) {
|
||||||
return logBad();
|
return logBad();
|
||||||
}
|
}
|
||||||
return applyAdmin(data);
|
return applyAdmin(data);
|
||||||
}, [&](const MTPDchannelParticipantSelf &data) {
|
}, [&](const MTPDchannelParticipantSelf &data) {
|
||||||
if (overrideRole != Role::Profile
|
if (overrideRole != Role::Profile
|
||||||
&& overrideRole != Role::Members) {
|
&& overrideRole != Role::Members
|
||||||
|
&& overrideRole != Role::Subscribers) {
|
||||||
return logBad();
|
return logBad();
|
||||||
}
|
}
|
||||||
return applyRegular(data.vuser_id());
|
return applyRegular(data.vuser_id());
|
||||||
}, [&](const MTPDchannelParticipant &data) {
|
}, [&](const MTPDchannelParticipant &data) {
|
||||||
if (overrideRole != Role::Profile
|
if (overrideRole != Role::Profile
|
||||||
&& overrideRole != Role::Members) {
|
&& overrideRole != Role::Members
|
||||||
|
&& overrideRole != Role::Subscribers) {
|
||||||
return logBad();
|
return logBad();
|
||||||
}
|
}
|
||||||
return applyRegular(data.vuser_id());
|
return applyRegular(data.vuser_id());
|
||||||
}, [&](const MTPDchannelParticipantBanned &data) {
|
}, [&](const MTPDchannelParticipantBanned &data) {
|
||||||
if (overrideRole != Role::Profile
|
if (overrideRole != Role::Profile
|
||||||
&& overrideRole != Role::Members
|
&& overrideRole != Role::Members
|
||||||
|
&& overrideRole != Role::Subscribers
|
||||||
&& overrideRole != Role::Restricted
|
&& overrideRole != Role::Restricted
|
||||||
&& overrideRole != Role::Kicked) {
|
&& overrideRole != Role::Kicked) {
|
||||||
return logBad();
|
return logBad();
|
||||||
|
|
@ -833,6 +838,7 @@ void ParticipantsBoxController::Start(
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Role::Members:
|
case Role::Members:
|
||||||
|
case Role::Subscribers:
|
||||||
return chat
|
return chat
|
||||||
? chat->canAddMembers()
|
? chat->canAddMembers()
|
||||||
: (channel->canAddMembers()
|
: (channel->canAddMembers()
|
||||||
|
|
@ -854,6 +860,7 @@ void ParticipantsBoxController::Start(
|
||||||
auto addNewItemText = [&] {
|
auto addNewItemText = [&] {
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Role::Members:
|
case Role::Members:
|
||||||
|
case Role::Subscribers:
|
||||||
return (chat || channel->isMegagroup())
|
return (chat || channel->isMegagroup())
|
||||||
? tr::lng_channel_add_members()
|
? tr::lng_channel_add_members()
|
||||||
: tr::lng_channel_add_users();
|
: tr::lng_channel_add_users();
|
||||||
|
|
@ -880,7 +887,7 @@ void ParticipantsBoxController::Start(
|
||||||
void ParticipantsBoxController::addNewItem() {
|
void ParticipantsBoxController::addNewItem() {
|
||||||
Expects(_role != Role::Profile);
|
Expects(_role != Role::Profile);
|
||||||
|
|
||||||
if (_role == Role::Members) {
|
if (_role == Role::Members || _role == Role::Subscribers) {
|
||||||
addNewParticipants();
|
addNewParticipants();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1056,6 +1063,7 @@ void ParticipantsBoxController::prepare() {
|
||||||
case Role::Admins: return tr::lng_channel_admins();
|
case Role::Admins: return tr::lng_channel_admins();
|
||||||
case Role::Profile:
|
case Role::Profile:
|
||||||
case Role::Members: return tr::lng_profile_participants_section();
|
case Role::Members: return tr::lng_profile_participants_section();
|
||||||
|
case Role::Subscribers: return tr::ktg_profile_subscribers_section();
|
||||||
case Role::Restricted: return tr::lng_exceptions_list_title();
|
case Role::Restricted: return tr::lng_exceptions_list_title();
|
||||||
case Role::Kicked: return tr::lng_removed_list_title();
|
case Role::Kicked: return tr::lng_removed_list_title();
|
||||||
}
|
}
|
||||||
|
|
@ -1080,7 +1088,7 @@ void ParticipantsBoxController::prepare() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticipantsBoxController::prepareChatRows(not_null<ChatData*> chat) {
|
void ParticipantsBoxController::prepareChatRows(not_null<ChatData*> chat) {
|
||||||
if (_role == Role::Profile || _role == Role::Members) {
|
if (_role == Role::Profile || _role == Role::Members || _role == Role::Subscribers) {
|
||||||
_onlineSorter = std::make_unique<ParticipantsOnlineSorter>(
|
_onlineSorter = std::make_unique<ParticipantsOnlineSorter>(
|
||||||
chat,
|
chat,
|
||||||
delegate());
|
delegate());
|
||||||
|
|
@ -1113,6 +1121,7 @@ void ParticipantsBoxController::prepareChatRows(not_null<ChatData*> chat) {
|
||||||
void ParticipantsBoxController::rebuildChatRows(not_null<ChatData*> chat) {
|
void ParticipantsBoxController::rebuildChatRows(not_null<ChatData*> chat) {
|
||||||
switch (_role) {
|
switch (_role) {
|
||||||
case Role::Profile:
|
case Role::Profile:
|
||||||
|
case Role::Subscribers:
|
||||||
case Role::Members: return rebuildChatParticipants(chat);
|
case Role::Members: return rebuildChatParticipants(chat);
|
||||||
case Role::Admins: return rebuildChatAdmins(chat);
|
case Role::Admins: return rebuildChatAdmins(chat);
|
||||||
case Role::Restricted:
|
case Role::Restricted:
|
||||||
|
|
@ -1235,7 +1244,7 @@ void ParticipantsBoxController::loadMoreRows() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto filter = [&] {
|
const auto filter = [&] {
|
||||||
if (_role == Role::Members || _role == Role::Profile) {
|
if (_role == Role::Members || _role == Role::Subscribers || _role == Role::Profile) {
|
||||||
return MTP_channelParticipantsRecent();
|
return MTP_channelParticipantsRecent();
|
||||||
} else if (_role == Role::Admins) {
|
} else if (_role == Role::Admins) {
|
||||||
return MTP_channelParticipantsAdmins();
|
return MTP_channelParticipantsAdmins();
|
||||||
|
|
@ -1262,7 +1271,7 @@ void ParticipantsBoxController::loadMoreRows() {
|
||||||
_loadRequestId = 0;
|
_loadRequestId = 0;
|
||||||
|
|
||||||
auto wasRecentRequest = firstLoad
|
auto wasRecentRequest = firstLoad
|
||||||
&& (_role == Role::Members || _role == Role::Profile);
|
&& (_role == Role::Members || _role == Role::Subscribers || _role == Role::Profile);
|
||||||
auto parseParticipants = [&](auto &&result, auto &&callback) {
|
auto parseParticipants = [&](auto &&result, auto &&callback) {
|
||||||
if (wasRecentRequest) {
|
if (wasRecentRequest) {
|
||||||
channel->session().api().parseRecentChannelParticipants(
|
channel->session().api().parseRecentChannelParticipants(
|
||||||
|
|
@ -1316,7 +1325,7 @@ void ParticipantsBoxController::refreshDescription() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticipantsBoxController::feedMegagroupLastParticipants() {
|
bool ParticipantsBoxController::feedMegagroupLastParticipants() {
|
||||||
if ((_role != Role::Members && _role != Role::Profile)
|
if ((_role != Role::Members && _role != Role::Subscribers && _role != Role::Profile)
|
||||||
|| delegate()->peerListFullRowsCount() > 0) {
|
|| delegate()->peerListFullRowsCount() > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1377,7 +1386,7 @@ void ParticipantsBoxController::rowActionClicked(
|
||||||
Expects(row->peer()->isUser());
|
Expects(row->peer()->isUser());
|
||||||
|
|
||||||
const auto user = row->peer()->asUser();
|
const auto user = row->peer()->asUser();
|
||||||
if (_role == Role::Members || _role == Role::Profile) {
|
if (_role == Role::Members || _role == Role::Subscribers || _role == Role::Profile) {
|
||||||
kickMember(user);
|
kickMember(user);
|
||||||
} else if (_role == Role::Admins) {
|
} else if (_role == Role::Admins) {
|
||||||
removeAdmin(user);
|
removeAdmin(user);
|
||||||
|
|
@ -1589,7 +1598,8 @@ void ParticipantsBoxController::editRestrictedDone(
|
||||||
prependRow(user);
|
prependRow(user);
|
||||||
} else if (_role == Role::Admins
|
} else if (_role == Role::Admins
|
||||||
|| _role == Role::Restricted
|
|| _role == Role::Restricted
|
||||||
|| _role == Role::Members) {
|
|| _role == Role::Members
|
||||||
|
|| _role == Role::Subscribers) {
|
||||||
removeRow(user);
|
removeRow(user);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1597,7 +1607,8 @@ void ParticipantsBoxController::editRestrictedDone(
|
||||||
prependRow(user);
|
prependRow(user);
|
||||||
} else if (_role == Role::Kicked
|
} else if (_role == Role::Kicked
|
||||||
|| _role == Role::Admins
|
|| _role == Role::Admins
|
||||||
|| _role == Role::Members) {
|
|| _role == Role::Members
|
||||||
|
|| _role == Role::Subscribers) {
|
||||||
removeRow(user);
|
removeRow(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1778,7 +1789,7 @@ std::unique_ptr<PeerListRow> ParticipantsBoxController::createRow(
|
||||||
if (_additional.canRestrictUser(user)) {
|
if (_additional.canRestrictUser(user)) {
|
||||||
row->setActionLink(tr::lng_profile_delete_removed(tr::now));
|
row->setActionLink(tr::lng_profile_delete_removed(tr::now));
|
||||||
}
|
}
|
||||||
} else if (_role == Role::Members) {
|
} else if (_role == Role::Members || _role == Role::Subscribers) {
|
||||||
if ((chat ? chat->canBanMembers() : channel->canBanMembers())
|
if ((chat ? chat->canBanMembers() : channel->canBanMembers())
|
||||||
&& !_additional.isCreator(user)
|
&& !_additional.isCreator(user)
|
||||||
&& (!_additional.adminRights(user)
|
&& (!_additional.adminRights(user)
|
||||||
|
|
@ -1989,6 +2000,7 @@ bool ParticipantsBoxSearchController::loadMoreRows() {
|
||||||
switch (_role) {
|
switch (_role) {
|
||||||
case Role::Admins: // Search for members, appoint as admin on found.
|
case Role::Admins: // Search for members, appoint as admin on found.
|
||||||
case Role::Profile:
|
case Role::Profile:
|
||||||
|
case Role::Subscribers:
|
||||||
case Role::Members:
|
case Role::Members:
|
||||||
return MTP_channelParticipantsSearch(MTP_string(_query));
|
return MTP_channelParticipantsSearch(MTP_string(_query));
|
||||||
case Role::Restricted:
|
case Role::Restricted:
|
||||||
|
|
@ -2067,7 +2079,7 @@ void ParticipantsBoxSearchController::searchDone(
|
||||||
_allLoaded = true;
|
_allLoaded = true;
|
||||||
}
|
}
|
||||||
const auto overrideRole = (_role == Role::Admins)
|
const auto overrideRole = (_role == Role::Admins)
|
||||||
? Role::Members
|
? (_channel->isMegagroup() ? Role::Members : Role::Subscribers)
|
||||||
: _role;
|
: _role;
|
||||||
for (const auto &data : list) {
|
for (const auto &data : list) {
|
||||||
const auto user = _additional->applyParticipant(
|
const auto user = _additional->applyParticipant(
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ void SubscribeToMigration(
|
||||||
enum class ParticipantsRole {
|
enum class ParticipantsRole {
|
||||||
Profile,
|
Profile,
|
||||||
Members,
|
Members,
|
||||||
|
Subscribers,
|
||||||
Admins,
|
Admins,
|
||||||
Restricted,
|
Restricted,
|
||||||
Kicked,
|
Kicked,
|
||||||
|
|
|
||||||
|
|
@ -965,7 +965,7 @@ void Controller::fillManageSection() {
|
||||||
if (canViewMembers) {
|
if (canViewMembers) {
|
||||||
AddButtonWithCount(
|
AddButtonWithCount(
|
||||||
_controls.buttonsLayout,
|
_controls.buttonsLayout,
|
||||||
tr::lng_manage_peer_members(),
|
(_isGroup ? tr::lng_manage_peer_members() : tr::ktg_manage_peer_subscribers()),
|
||||||
Info::Profile::MigratedOrMeValue(
|
Info::Profile::MigratedOrMeValue(
|
||||||
_peer
|
_peer
|
||||||
) | rpl::map(
|
) | rpl::map(
|
||||||
|
|
@ -976,7 +976,7 @@ void Controller::fillManageSection() {
|
||||||
ParticipantsBoxController::Start(
|
ParticipantsBoxController::Start(
|
||||||
navigation,
|
navigation,
|
||||||
_peer,
|
_peer,
|
||||||
ParticipantsBoxController::Role::Members);
|
(_isGroup ? ParticipantsBoxController::Role::Members : ParticipantsBoxController::Role::Subscribers));
|
||||||
},
|
},
|
||||||
st::infoIconMembers);
|
st::infoIconMembers);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue