2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Pass Ui::Show to all add participant handlers.

This commit is contained in:
John Preston
2024-04-01 17:54:44 +04:00
parent 5741bd9cca
commit 87acc921c3
18 changed files with 82 additions and 41 deletions

View File

@@ -487,9 +487,9 @@ void ChatParticipants::requestCountDelayed(
}
void ChatParticipants::add(
std::shared_ptr<Ui::Show> show,
not_null<PeerData*> peer,
const std::vector<not_null<UserData*>> &users,
std::shared_ptr<Ui::Show> show,
bool passGroupHistory,
Fn<void(bool)> done) {
if (const auto chat = peer->asChat()) {
@@ -504,14 +504,14 @@ void ChatParticipants::add(
if (done) done(true);
}).fail([=](const MTP::Error &error) {
const auto type = error.type();
ShowAddParticipantsError(type, peer, { 1, user }, show);
ShowAddParticipantsError(show, type, peer, { 1, user });
if (done) done(false);
}).afterDelay(kSmallDelayMs).send();
}
} else if (const auto channel = peer->asChannel()) {
const auto hasBot = ranges::any_of(users, &UserData::isBot);
if (!peer->isMegagroup() && hasBot) {
ShowAddParticipantsError("USER_BOT", peer, users, show);
ShowAddParticipantsError(show, "USER_BOT", peer, users);
return;
}
auto list = QVector<MTPInputUser>();
@@ -531,7 +531,7 @@ void ChatParticipants::add(
channel,
CollectForbiddenUsers(&channel->session(), result));
}).fail([=](const MTP::Error &error) {
ShowAddParticipantsError(error.type(), peer, users, show);
ShowAddParticipantsError(show, error.type(), peer, users);
if (callback) callback(false);
}).afterDelay(kSmallDelayMs).send();
};

View File

@@ -97,9 +97,9 @@ public:
not_null<ChannelData*> channel,
const TLMembers &data);
void add(
std::shared_ptr<Ui::Show> show,
not_null<PeerData*> peer,
const std::vector<not_null<UserData*>> &users,
std::shared_ptr<Ui::Show> show = nullptr,
bool passGroupHistory = true,
Fn<void(bool)> done = nullptr);