Moved code for api participants to separated file.

This commit is contained in:
23rd
2021-11-24 07:25:05 +03:00
committed by John Preston
parent 3271cdf251
commit b9c64499bd
24 changed files with 840 additions and 730 deletions

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "profile/profile_block_group_members.h"
#include "api/api_chat_participants.h"
#include "styles/style_profile.h"
#include "ui/widgets/labels.h"
#include "ui/boxes/confirm_box.h"
@@ -89,10 +90,10 @@ void GroupMembersWidget::removePeer(PeerData *selectedPeer) {
const auto callback = [=] {
Ui::hideLayer();
if (const auto chat = peer->asChat()) {
chat->session().api().kickParticipant(chat, user);
chat->session().api().chatParticipants().kick(chat, user);
Ui::showPeerHistory(chat, ShowAtTheEndMsgId);
} else if (const auto channel = peer->asChannel()) {
channel->session().api().kickParticipant(
channel->session().api().chatParticipants().kick(
channel,
user,
currentRestrictedRights);
@@ -158,7 +159,7 @@ void GroupMembersWidget::preloadMore() {
//if (auto megagroup = peer()->asMegagroup()) {
// auto &megagroupInfo = megagroup->mgInfo;
// if (!megagroupInfo->lastParticipants.isEmpty() && megagroupInfo->lastParticipants.size() < megagroup->membersCount()) {
// peer()->session().api().requestLastParticipants(megagroup, false);
// peer()->session().api().requestLast(megagroup, false);
// }
//}
}
@@ -198,7 +199,8 @@ void GroupMembersWidget::refreshMembers() {
fillChatMembers(chat);
} else if (const auto megagroup = peer()->asMegagroup()) {
if (megagroup->lastParticipantsRequestNeeded()) {
megagroup->session().api().requestLastParticipants(megagroup);
megagroup->session().api().chatParticipants().requestLast(
megagroup);
}
fillMegagroupMembers(megagroup);
}