fix: readonly chats on sync

This commit is contained in:
Adhiraj Singh
2022-05-09 16:03:53 +05:30
parent 64a6070845
commit bf8ff6d253
2 changed files with 6 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import { promisify } from 'util'
import { inflate } from 'zlib' import { inflate } from 'zlib'
import { proto } from '../../WAProto' import { proto } from '../../WAProto'
import { Chat, Contact } from '../Types' import { Chat, Contact } from '../Types'
import { isJidUser } from '../WABinary'
import { downloadContentFromMessage } from './messages-media' import { downloadContentFromMessage } from './messages-media'
const inflatePromise = promisify(inflate) const inflatePromise = promisify(inflate)
@@ -45,6 +46,10 @@ export const processHistoryMessage = (item: proto.IHistorySync, historyCache: Se
delete chat.messages delete chat.messages
if(!historyCache.has(chat.id)) { if(!historyCache.has(chat.id)) {
if(isJidUser(chat.id) && chat.readOnly && chat.archived) {
chat.readOnly = false
}
chats.push(chat) chats.push(chat)
historyCache.add(chat.id) historyCache.add(chat.id)
} }

View File

@@ -46,6 +46,7 @@ const processMessage = async(
if(accountSettings?.unarchiveChats) { if(accountSettings?.unarchiveChats) {
chat.archive = false chat.archive = false
chat.readOnly = false
} }
} }