mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-27 04:45:08 +01:00
Update members count from full chat info
This commit is contained in:
parent
897c2f69ef
commit
2b55037b08
@ -339,6 +339,7 @@ async function getFullChatInfo(chatId: string): Promise<{
|
||||
fullInfo: ApiChatFullInfo;
|
||||
users?: ApiUser[];
|
||||
groupCall?: Partial<ApiGroupCall>;
|
||||
membersCount?: number;
|
||||
} | undefined> {
|
||||
const result = await invokeRequest(new GramJs.messages.GetFullChat({
|
||||
chatId: buildInputEntity(chatId) as BigInt.BigInteger,
|
||||
@ -391,6 +392,7 @@ async function getFullChatInfo(chatId: string): Promise<{
|
||||
version: 0,
|
||||
participants: {},
|
||||
} : undefined,
|
||||
membersCount: members?.length,
|
||||
};
|
||||
}
|
||||
|
||||
@ -402,6 +404,7 @@ async function getFullChannelInfo(
|
||||
fullInfo: ApiChatFullInfo;
|
||||
users?: ApiUser[];
|
||||
groupCall?: Partial<ApiGroupCall>;
|
||||
membersCount?: number;
|
||||
} | undefined> {
|
||||
const result = await invokeRequest(new GramJs.channels.GetFullChannel({
|
||||
channel: buildInputEntity(id, accessHash) as GramJs.InputChannel,
|
||||
@ -430,6 +433,7 @@ async function getFullChannelInfo(
|
||||
requestsPending,
|
||||
recentRequesters,
|
||||
statsDc,
|
||||
participantsCount,
|
||||
} = result.fullChat;
|
||||
|
||||
const inviteLink = exportedInvite instanceof GramJs.ChatInviteExported
|
||||
@ -498,6 +502,7 @@ async function getFullChannelInfo(
|
||||
participantsCount: 0,
|
||||
connectionState: 'disconnected',
|
||||
} : undefined,
|
||||
membersCount: participantsCount,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1079,7 +1079,9 @@ export async function loadFullChat(chat: ApiChat) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const { users, fullInfo, groupCall } = result;
|
||||
const {
|
||||
users, fullInfo, groupCall, membersCount,
|
||||
} = result;
|
||||
|
||||
let global = getGlobal();
|
||||
if (users) {
|
||||
@ -1097,7 +1099,10 @@ export async function loadFullChat(chat: ApiChat) {
|
||||
);
|
||||
}
|
||||
|
||||
global = updateChat(global, chat.id, { fullInfo });
|
||||
global = updateChat(global, chat.id, {
|
||||
fullInfo,
|
||||
...(membersCount && { membersCount }),
|
||||
});
|
||||
|
||||
setGlobal(global);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user