From bf8ff6d253b87254ada256a40930108ef836b42e Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Mon, 9 May 2022 16:03:53 +0530 Subject: [PATCH] fix: readonly chats on sync --- src/Utils/history.ts | 5 +++++ src/Utils/process-message.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/src/Utils/history.ts b/src/Utils/history.ts index 15c3d17..e0510b4 100644 --- a/src/Utils/history.ts +++ b/src/Utils/history.ts @@ -2,6 +2,7 @@ import { promisify } from 'util' import { inflate } from 'zlib' import { proto } from '../../WAProto' import { Chat, Contact } from '../Types' +import { isJidUser } from '../WABinary' import { downloadContentFromMessage } from './messages-media' const inflatePromise = promisify(inflate) @@ -45,6 +46,10 @@ export const processHistoryMessage = (item: proto.IHistorySync, historyCache: Se delete chat.messages if(!historyCache.has(chat.id)) { + if(isJidUser(chat.id) && chat.readOnly && chat.archived) { + chat.readOnly = false + } + chats.push(chat) historyCache.add(chat.id) } diff --git a/src/Utils/process-message.ts b/src/Utils/process-message.ts index 4c09563..3a0289c 100644 --- a/src/Utils/process-message.ts +++ b/src/Utils/process-message.ts @@ -46,6 +46,7 @@ const processMessage = async( if(accountSettings?.unarchiveChats) { chat.archive = false + chat.readOnly = false } }