From 919781488b666b6b3eabceaccc1ec403368b378f Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Mon, 4 Oct 2021 09:48:33 +0530 Subject: [PATCH] upsert contact on app sync patch + add message.participant to full message --- src/Socket/chats.ts | 4 ++-- src/Socket/messages-recv.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index 28fb5cd..467ecb7 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -300,7 +300,7 @@ export const makeChatsSocket = (config: SocketConfig) => { const processSyncActions = (actions: ChatMutation[]) => { const updates: { [jid: string]: Partial } = {} - const contactUpdates: { [jid: string]: Partial } = {} + const contactUpdates: { [jid: string]: Contact } = {} const msgDeletes: proto.IMessageKey[] = [] for(const { action, index: [_, id, msgId, fromMe] } of actions) { @@ -343,7 +343,7 @@ export const makeChatsSocket = (config: SocketConfig) => { ev.emit('chats.update', Object.values(updates)) } if(Object.values(contactUpdates).length) { - ev.emit('contacts.update', Object.values(contactUpdates)) + ev.emit('contacts.upsert', Object.values(contactUpdates)) } if(msgDeletes.length) { ev.emit('messages.delete', { keys: msgDeletes }) diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index a8beb20..7ee5f8e 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -349,7 +349,8 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { message, status: isMe ? proto.WebMessageInfo.WebMessageInfoStatus.SERVER_ACK : null, messageTimestamp: dec.timestamp, - pushName: dec.pushname + pushName: dec.pushname, + participant: dec.participant }) }