mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: messaging-history.set event not emitting syncType and progress / add PDO request id (#1042)
* initial commit * add PDO request id
This commit is contained in:
@@ -23,6 +23,7 @@ export type BaileysEventMap = {
|
|||||||
isLatest?: boolean
|
isLatest?: boolean
|
||||||
progress?: number | null
|
progress?: number | null
|
||||||
syncType?: proto.HistorySync.HistorySyncType
|
syncType?: proto.HistorySync.HistorySyncType
|
||||||
|
peerDataRequestSessionId?: string | null
|
||||||
}
|
}
|
||||||
/** upsert chats */
|
/** upsert chats */
|
||||||
'chats.upsert': Chat[]
|
'chats.upsert': Chat[]
|
||||||
@@ -73,6 +74,9 @@ export type BufferedEventData = {
|
|||||||
messages: { [uqId: string]: WAMessage }
|
messages: { [uqId: string]: WAMessage }
|
||||||
empty: boolean
|
empty: boolean
|
||||||
isLatest: boolean
|
isLatest: boolean
|
||||||
|
progress?: number | null
|
||||||
|
syncType?: proto.HistorySync.HistorySyncType
|
||||||
|
peerDataRequestSessionId?: string
|
||||||
}
|
}
|
||||||
chatUpserts: { [jid: string]: Chat }
|
chatUpserts: { [jid: string]: Chat }
|
||||||
chatUpdates: { [jid: string]: ChatUpdate }
|
chatUpdates: { [jid: string]: ChatUpdate }
|
||||||
|
|||||||
@@ -230,6 +230,9 @@ function append<E extends BufferableEvent>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
data.historySets.empty = false
|
data.historySets.empty = false
|
||||||
|
data.historySets.syncType = eventData.syncType
|
||||||
|
data.historySets.progress = eventData.progress
|
||||||
|
data.historySets.peerDataRequestSessionId = eventData.peerDataRequestSessionId
|
||||||
data.historySets.isLatest = eventData.isLatest || data.historySets.isLatest
|
data.historySets.isLatest = eventData.isLatest || data.historySets.isLatest
|
||||||
|
|
||||||
break
|
break
|
||||||
@@ -521,7 +524,10 @@ function consolidateEvents(data: BufferedEventData) {
|
|||||||
chats: Object.values(data.historySets.chats),
|
chats: Object.values(data.historySets.chats),
|
||||||
messages: Object.values(data.historySets.messages),
|
messages: Object.values(data.historySets.messages),
|
||||||
contacts: Object.values(data.historySets.contacts),
|
contacts: Object.values(data.historySets.contacts),
|
||||||
isLatest: data.historySets.isLatest
|
syncType: data.historySets.syncType,
|
||||||
|
progress: data.historySets.progress,
|
||||||
|
isLatest: data.historySets.isLatest,
|
||||||
|
peerDataRequestSessionId: data.historySets.peerDataRequestSessionId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export const processHistoryMessage = (item: proto.IHistorySync) => {
|
|||||||
contacts,
|
contacts,
|
||||||
messages,
|
messages,
|
||||||
syncType: item.syncType,
|
syncType: item.syncType,
|
||||||
progress: item.progress,
|
progress: item.progress
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -223,7 +223,8 @@ const processMessage = async(
|
|||||||
isLatest:
|
isLatest:
|
||||||
histNotification.syncType !== proto.HistorySync.HistorySyncType.ON_DEMAND
|
histNotification.syncType !== proto.HistorySync.HistorySyncType.ON_DEMAND
|
||||||
? isLatest
|
? isLatest
|
||||||
: undefined
|
: undefined,
|
||||||
|
peerDataRequestSessionId: histNotification.peerDataRequestSessionId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user