From 3f33de268970eb0692a7e6879ef90c5fff135e0e Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 16 Sep 2022 19:28:51 +0200 Subject: [PATCH] Group Chat Info: Fix missing members count --- src/api/gramjs/apiBuilders/chats.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/api/gramjs/apiBuilders/chats.ts b/src/api/gramjs/apiBuilders/chats.ts index 5db66526..a5680421 100644 --- a/src/api/gramjs/apiBuilders/chats.ts +++ b/src/api/gramjs/apiBuilders/chats.ts @@ -48,16 +48,18 @@ function buildApiChatFieldsFromPeerEntity( ...(accessHash && { accessHash }), hasVideoAvatar, ...(avatarHash && { avatarHash }), - ...(('username' in peerEntity) && { username: peerEntity.username }), - ...(('verified' in peerEntity) && { isVerified: peerEntity.verified }), - ...(('callActive' in peerEntity) && { isCallActive: peerEntity.callActive }), - ...(('callNotEmpty' in peerEntity) && { isCallNotEmpty: peerEntity.callNotEmpty }), + ...('username' in peerEntity && { username: peerEntity.username }), + ...('verified' in peerEntity && { isVerified: peerEntity.verified }), + ...('callActive' in peerEntity && { isCallActive: peerEntity.callActive }), + ...('callNotEmpty' in peerEntity && { isCallNotEmpty: peerEntity.callNotEmpty }), ...('date' in peerEntity && { joinDate: peerEntity.date }), - ...('participantsCount' in peerEntity && { membersCount: peerEntity.participantsCount }), - ...(('noforwards' in peerEntity) && { isProtected: Boolean(peerEntity.noforwards) }), + ...('participantsCount' in peerEntity && peerEntity.participantsCount !== undefined && { + membersCount: peerEntity.participantsCount, + }), + ...('noforwards' in peerEntity && { isProtected: Boolean(peerEntity.noforwards) }), ...(isSupport && { isSupport: true }), ...buildApiChatPermissions(peerEntity), - ...(('creator' in peerEntity) && { isCreator: peerEntity.creator }), + ...('creator' in peerEntity && { isCreator: peerEntity.creator }), ...buildApiChatRestrictions(peerEntity), ...buildApiChatMigrationInfo(peerEntity), fakeType: isScam ? 'scam' : (isFake ? 'fake' : undefined),