From 2a8ce563a220c9a28cddf692806fef5d2c65fab9 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Sun, 6 Nov 2022 19:51:45 +0530 Subject: [PATCH] chore: remove redundant newMutations log --- src/Socket/chats.ts | 5 +---- src/Utils/chat-utils.ts | 9 ++++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index 4a53f8f..1d7c837 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -370,7 +370,7 @@ export const makeChatsSocket = (config: SocketConfig) => { // only process if there are syncd patches if(patches.length) { - const { newMutations, state: newState } = await decodePatches( + const { state: newState } = await decodePatches( name, patches, states[name], @@ -383,9 +383,6 @@ export const makeChatsSocket = (config: SocketConfig) => { await authState.keys.set({ 'app-state-sync-version': { [name]: newState } }) logger.info(`synced ${name} to v${newState.version}`) - if(newMutations.length) { - logger.trace({ newMutations, name }, 'recv new mutations') - } } if(hasMorePatches) { diff --git a/src/Utils/chat-utils.ts b/src/Utils/chat-utils.ts index b3e8d5c..5de42e1 100644 --- a/src/Utils/chat-utils.ts +++ b/src/Utils/chat-utils.ts @@ -415,7 +415,6 @@ export const decodePatches = async( validateMacs: boolean = true ) => { syncds = [...syncds] - const successfulMutations: ChatMutation[] = [] const newState: LTHashState = { ...initial, @@ -461,10 +460,7 @@ export const decodePatches = async( syncds.splice(0, 1) } - return { - newMutations: successfulMutations, - state: newState - } + return { state: newState } } export const chatModificationToAppPatch = ( @@ -620,10 +616,13 @@ export const processSyncAction = ( const isInitialSync = !!initialSyncOpts const accountSettings = initialSyncOpts?.accountSettings + logger?.trace({ syncAction, initialSync: !!initialSyncOpts }, 'processing sync action') + const { syncAction: { value: action }, index: [type, id, msgId, fromMe] } = syncAction + if(action?.muteAction) { ev.emit( 'chats.update',