Merge prepare: revert "subscribers" instead of "members"

This commit is contained in:
Eric Kotato 2020-05-01 17:18:02 +03:00
parent e7eb585475
commit be2444b3da
9 changed files with 20 additions and 59 deletions

View file

@ -2438,12 +2438,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ktg_user_status_unaccessible" = "account inaccessible";
"ktg_chat_status_subscribers#one" = "{count} subscriber";
"ktg_chat_status_subscribers#other" = "{count} subscribers";
"ktg_profile_subscribers_section" = "Subscribers";
"ktg_manage_peer_subscribers" = "Subscribers";
"ktg_settings_show_json_settings" = "Show custom settings";
"ktg_settings_restart" = "Restart Kotatogram";

View file

@ -34,14 +34,6 @@
"ktg_mac_menu_show": "Показать Kotatogram",
"ktg_settings_kotato": "Настройки Kotatogram",
"ktg_user_status_unaccessible": "аккаунт недоступен",
"ktg_chat_status_subscribers": {
"one": "{count} подписчик",
"few": "{count} подписчика",
"many": "{count} подписчиков",
"other": "{count} подписчиков"
},
"ktg_profile_subscribers_section": "Подписчики",
"ktg_manage_peer_subscribers": "Подписчики",
"ktg_settings_show_json_settings": "Показать файл настроек",
"ktg_settings_restart": "Перезапустить Kotatogram",
"ktg_copy_btn_callback": "Копировать callback-данные",

View file

@ -517,7 +517,6 @@ UserData *ParticipantsAdditionalData::applyParticipant(
return data.match([&](const MTPDchannelParticipantCreator &data) {
if (overrideRole != Role::Profile
&& overrideRole != Role::Members
&& overrideRole != Role::Subscribers
&& overrideRole != Role::Admins) {
return logBad();
}
@ -525,29 +524,25 @@ UserData *ParticipantsAdditionalData::applyParticipant(
}, [&](const MTPDchannelParticipantAdmin &data) {
if (overrideRole != Role::Profile
&& overrideRole != Role::Members
&& overrideRole != Role::Subscribers
&& overrideRole != Role::Admins) {
return logBad();
}
return applyAdmin(data);
}, [&](const MTPDchannelParticipantSelf &data) {
if (overrideRole != Role::Profile
&& overrideRole != Role::Members
&& overrideRole != Role::Subscribers) {
&& overrideRole != Role::Members) {
return logBad();
}
return applyRegular(data.vuser_id());
}, [&](const MTPDchannelParticipant &data) {
if (overrideRole != Role::Profile
&& overrideRole != Role::Members
&& overrideRole != Role::Subscribers) {
&& overrideRole != Role::Members) {
return logBad();
}
return applyRegular(data.vuser_id());
}, [&](const MTPDchannelParticipantBanned &data) {
if (overrideRole != Role::Profile
&& overrideRole != Role::Members
&& overrideRole != Role::Subscribers
&& overrideRole != Role::Restricted
&& overrideRole != Role::Kicked) {
return logBad();
@ -839,7 +834,6 @@ void ParticipantsBoxController::Start(
switch (role) {
case Role::Members:
case Role::Subscribers:
return chat
? chat->canAddMembers()
: (channel->canAddMembers()
@ -861,7 +855,6 @@ void ParticipantsBoxController::Start(
auto addNewItemText = [&] {
switch (role) {
case Role::Members:
case Role::Subscribers:
return (chat || channel->isMegagroup())
? tr::lng_channel_add_members()
: tr::lng_channel_add_users();
@ -888,7 +881,7 @@ void ParticipantsBoxController::Start(
void ParticipantsBoxController::addNewItem() {
Expects(_role != Role::Profile);
if (_role == Role::Members || _role == Role::Subscribers) {
if (_role == Role::Members) {
addNewParticipants();
return;
}
@ -1064,7 +1057,6 @@ void ParticipantsBoxController::prepare() {
case Role::Admins: return tr::lng_channel_admins();
case Role::Profile:
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::Kicked: return tr::lng_removed_list_title();
}
@ -1089,7 +1081,7 @@ void ParticipantsBoxController::prepare() {
}
void ParticipantsBoxController::prepareChatRows(not_null<ChatData*> chat) {
if (_role == Role::Profile || _role == Role::Members || _role == Role::Subscribers) {
if (_role == Role::Profile || _role == Role::Members) {
_onlineSorter = std::make_unique<ParticipantsOnlineSorter>(
chat,
delegate());
@ -1122,7 +1114,6 @@ void ParticipantsBoxController::prepareChatRows(not_null<ChatData*> chat) {
void ParticipantsBoxController::rebuildChatRows(not_null<ChatData*> chat) {
switch (_role) {
case Role::Profile:
case Role::Subscribers:
case Role::Members: return rebuildChatParticipants(chat);
case Role::Admins: return rebuildChatAdmins(chat);
case Role::Restricted:
@ -1245,7 +1236,7 @@ void ParticipantsBoxController::loadMoreRows() {
}
const auto filter = [&] {
if (_role == Role::Members || _role == Role::Subscribers || _role == Role::Profile) {
if (_role == Role::Members || _role == Role::Profile) {
return MTP_channelParticipantsRecent();
} else if (_role == Role::Admins) {
return MTP_channelParticipantsAdmins();
@ -1272,7 +1263,7 @@ void ParticipantsBoxController::loadMoreRows() {
_loadRequestId = 0;
auto wasRecentRequest = firstLoad
&& (_role == Role::Members || _role == Role::Subscribers || _role == Role::Profile);
&& (_role == Role::Members || _role == Role::Profile);
auto parseParticipants = [&](auto &&result, auto &&callback) {
if (wasRecentRequest) {
channel->session().api().parseRecentChannelParticipants(
@ -1326,7 +1317,7 @@ void ParticipantsBoxController::refreshDescription() {
}
bool ParticipantsBoxController::feedMegagroupLastParticipants() {
if ((_role != Role::Members && _role != Role::Subscribers && _role != Role::Profile)
if ((_role != Role::Members && _role != Role::Profile)
|| delegate()->peerListFullRowsCount() > 0) {
return false;
}
@ -1387,7 +1378,7 @@ void ParticipantsBoxController::rowActionClicked(
Expects(row->peer()->isUser());
const auto user = row->peer()->asUser();
if (_role == Role::Members || _role == Role::Subscribers || _role == Role::Profile) {
if (_role == Role::Members || _role == Role::Profile) {
kickMember(user);
} else if (_role == Role::Admins) {
removeAdmin(user);
@ -1602,8 +1593,7 @@ void ParticipantsBoxController::editRestrictedDone(
prependRow(user);
} else if (_role == Role::Admins
|| _role == Role::Restricted
|| _role == Role::Members
|| _role == Role::Subscribers) {
|| _role == Role::Members) {
removeRow(user);
}
} else {
@ -1611,8 +1601,7 @@ void ParticipantsBoxController::editRestrictedDone(
prependRow(user);
} else if (_role == Role::Kicked
|| _role == Role::Admins
|| _role == Role::Members
|| _role == Role::Subscribers) {
|| _role == Role::Members) {
removeRow(user);
}
}
@ -1793,7 +1782,7 @@ std::unique_ptr<PeerListRow> ParticipantsBoxController::createRow(
if (_additional.canRestrictUser(user)) {
row->setActionLink(tr::lng_profile_delete_removed(tr::now));
}
} else if (_role == Role::Members || _role == Role::Subscribers) {
} else if (_role == Role::Members) {
if ((chat ? chat->canBanMembers() : channel->canBanMembers())
&& !_additional.isCreator(user)
&& (!_additional.adminRights(user)
@ -2005,7 +1994,6 @@ bool ParticipantsBoxSearchController::loadMoreRows() {
switch (_role) {
case Role::Admins: // Search for members, appoint as admin on found.
case Role::Profile:
case Role::Subscribers:
case Role::Members:
return MTP_channelParticipantsSearch(MTP_string(_query));
case Role::Restricted:
@ -2084,7 +2072,7 @@ void ParticipantsBoxSearchController::searchDone(
_allLoaded = true;
}
const auto overrideRole = (_role == Role::Admins)
? (_channel->isMegagroup() ? Role::Members : Role::Subscribers)
? Role::Members
: _role;
for (const auto &data : list) {
const auto user = _additional->applyParticipant(

View file

@ -45,7 +45,6 @@ void SubscribeToMigration(
enum class ParticipantsRole {
Profile,
Members,
Subscribers,
Admins,
Restricted,
Kicked,

View file

@ -967,7 +967,7 @@ void Controller::fillManageSection() {
if (canViewMembers) {
AddButtonWithCount(
_controls.buttonsLayout,
(_isGroup ? tr::lng_manage_peer_members() : tr::ktg_manage_peer_subscribers()),
tr::lng_manage_peer_members(),
Info::Profile::MigratedOrMeValue(
_peer
) | rpl::map(
@ -978,7 +978,7 @@ void Controller::fillManageSection() {
ParticipantsBoxController::Start(
navigation,
_peer,
(_isGroup ? ParticipantsBoxController::Role::Members : ParticipantsBoxController::Role::Subscribers));
ParticipantsBoxController::Role::Members);
},
st::infoIconMembers);
}

View file

@ -921,9 +921,7 @@ void TopBarWidget::updateOnlineDisplay() {
text = tr::lng_group_status(tr::now);
}
} else if (channel->membersCount() > 0) {
text = channel->isMegagroup()
? tr::lng_chat_status_members(tr::now, lt_count_decimal, channel->membersCount())
: tr::ktg_chat_status_subscribers(tr::now, lt_count_decimal, channel->membersCount());
text = tr::lng_chat_status_members(tr::now, lt_count_decimal, channel->membersCount());
} else {
text = channel->isMegagroup() ? tr::lng_group_status(tr::now) : tr::lng_channel_status(tr::now);

View file

@ -605,11 +605,6 @@ rpl::producer<QString> TitleValue(
return tr::lng_profile_common_groups_section();
case Section::Type::Members:
if (const auto channel = peer->asChannel()) {
return channel->isMegagroup()
? tr::lng_profile_participants_section()
: tr::ktg_profile_subscribers_section();
}
return tr::lng_profile_participants_section();
//case Section::Type::Channels: // #feed

View file

@ -883,7 +883,7 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
channel,
MTPDchannelFull::Flag::f_can_view_participants),
(_1 > 0) && _2);
auto membersText = tr::ktg_chat_status_subscribers(
auto membersText = tr::lng_chat_status_members(
lt_count_decimal,
MembersCountValue(channel) | tr::to_count());
auto membersCallback = [=] {

View file

@ -146,15 +146,10 @@ auto ChatStatusText(int fullCount, int onlineCount, bool isGroup) {
lt_online_count,
OnlineStatusText(onlineCount));
} else if (fullCount > 0) {
return isGroup
? tr::lng_chat_status_members(
tr::now,
lt_count_decimal,
fullCount)
: tr::ktg_chat_status_subscribers(
tr::now,
lt_count_decimal,
fullCount);
return tr::lng_chat_status_members(
tr::now,
lt_count_decimal,
fullCount);
}
return isGroup
? tr::lng_group_status(tr::now)