Always pass all users to add group member box.

This commit is contained in:
John Preston 2017-12-08 18:25:29 +04:00
parent 90f5f7dded
commit a403ad7d37
2 changed files with 13 additions and 13 deletions

View File

@ -332,17 +332,22 @@ void Members::updateHeaderControlsGeometry(int newWidth) {
}
void Members::addMember() {
if (auto chat = _peer->asChat()) {
if (const auto chat = _peer->asChat()) {
if (chat->count >= Global::ChatSizeMax() && chat->amCreator()) {
Ui::show(Box<ConvertToSupergroupBox>(chat));
} else {
AddParticipantsBoxController::Start(chat);
}
} else if (auto channel = _peer->asChannel()) {
if (channel->mgInfo) {
auto &participants = channel->mgInfo->lastParticipants;
AddParticipantsBoxController::Start(channel, { participants.cbegin(), participants.cend() });
}
} else if (const auto channel = _peer->asChannel()) {
const auto state = _listController->saveState();
const auto users = ranges::view::all(
state->list
) | ranges::view::transform([](not_null<PeerData*> peer) {
return peer->asUser();
});
AddParticipantsBoxController::Start(
channel,
{ users.begin(), users.end() });
}
}

View File

@ -496,13 +496,8 @@ void ShowForwardMessagesBox(
}
void PeerMenuAddChannelMembers(not_null<ChannelData*> channel) {
if (channel->isMegagroup()) {
auto &participants = channel->mgInfo->lastParticipants;
AddParticipantsBoxController::Start(
channel,
{ participants.cbegin(), participants.cend() });
return;
} else if (channel->membersCount() >= Global::ChatSizeMax()) {
if (!channel->isMegagroup()
&& channel->membersCount() >= Global::ChatSizeMax()) {
Ui::show(
Box<MaxInviteBox>(channel),
LayerOption::KeepOther);