upsert contact on app sync patch + add message.participant to full message

This commit is contained in:
Adhiraj Singh
2021-10-04 09:48:33 +05:30
parent 0c1045b55b
commit 919781488b
2 changed files with 4 additions and 3 deletions

View File

@@ -300,7 +300,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
const processSyncActions = (actions: ChatMutation[]) => {
const updates: { [jid: string]: Partial<Chat> } = {}
const contactUpdates: { [jid: string]: Partial<Contact> } = {}
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 })

View File

@@ -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
})
}