mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
docs: add some comments for "chatModify" + logging for app patch
This commit is contained in:
@@ -412,6 +412,8 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
const name = patchCreate.type
|
const name = patchCreate.type
|
||||||
await mutationMutex.mutex(
|
await mutationMutex.mutex(
|
||||||
async() => {
|
async() => {
|
||||||
|
logger.debug({ patch: patchCreate }, 'applying app patch')
|
||||||
|
|
||||||
await resyncAppState([name])
|
await resyncAppState([name])
|
||||||
const initial = await authState.keys.getAppStateSyncVersion(name)
|
const initial = await authState.keys.getAppStateSyncVersion(name)
|
||||||
const { patch, state } = await encodeSyncdPatch(
|
const { patch, state } = await encodeSyncdPatch(
|
||||||
@@ -463,7 +465,11 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* modify a chat -- mark unread, read etc.
|
||||||
|
* lastMessages must be sorted in reverse chronologically
|
||||||
|
* requires the last messages till the last message received; required for archive & unread
|
||||||
|
*/
|
||||||
const chatModify = (mod: ChatModification, jid: string, lastMessages: Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>[]) => {
|
const chatModify = (mod: ChatModification, jid: string, lastMessages: Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>[]) => {
|
||||||
const patch = chatModificationToAppPatch(mod, jid, lastMessages)
|
const patch = chatModificationToAppPatch(mod, jid, lastMessages)
|
||||||
return appPatch(patch)
|
return appPatch(patch)
|
||||||
|
|||||||
Reference in New Issue
Block a user