Compare commits

...

3 Commits

Author SHA1 Message Date
Renato Alcara 08456fcf0c Merge branch 'master' into fix/pn-lid-session-reuse 2026-03-16 23:19:48 -03:00
Renato Alcara 029796209a fix: limit PN/LID reuse changes to session cache 2026-03-16 23:17:26 -03:00
Renato Alcara 6c5dcb29a6 fix: unify PN and LID session reuse for 1:1 sends 2026-03-16 22:55:16 -03:00
+6 -4
View File
@@ -1011,6 +1011,8 @@ export const makeMessagesSocket = (config: SocketConfig) => {
allRecipients.push(jid) allRecipients.push(jid)
} }
await assertSessions(allRecipients)
const effectiveMeRecipients = await canonicalizeSessionRecipients(meRecipients) const effectiveMeRecipients = await canonicalizeSessionRecipients(meRecipients)
const effectiveOtherRecipients = await canonicalizeSessionRecipients(otherRecipients) const effectiveOtherRecipients = await canonicalizeSessionRecipients(otherRecipients)
const effectiveAllRecipients = [...effectiveMeRecipients, ...effectiveOtherRecipients] const effectiveAllRecipients = [...effectiveMeRecipients, ...effectiveOtherRecipients]
@@ -1022,14 +1024,14 @@ export const makeMessagesSocket = (config: SocketConfig) => {
{ nodes: otherNodes, shouldIncludeDeviceIdentity: s2 } { nodes: otherNodes, shouldIncludeDeviceIdentity: s2 }
] = await Promise.all([ ] = await Promise.all([
// For own devices: use DSM if available (1:1 chats only) // For own devices: use DSM if available (1:1 chats only)
createParticipantNodes(effectiveMeRecipients, meMsg || message, extraAttrs), createParticipantNodes(meRecipients, meMsg || message, extraAttrs),
createParticipantNodes(effectiveOtherRecipients, message, extraAttrs, meMsg) createParticipantNodes(otherRecipients, message, extraAttrs, meMsg)
]) ])
participants.push(...meNodes) participants.push(...meNodes)
participants.push(...otherNodes) participants.push(...otherNodes)
if (effectiveMeRecipients.length > 0 || effectiveOtherRecipients.length > 0) { if (meRecipients.length > 0 || otherRecipients.length > 0) {
extraAttrs['phash'] = generateParticipantHashV2([...effectiveMeRecipients, ...effectiveOtherRecipients]) extraAttrs['phash'] = generateParticipantHashV2([...meRecipients, ...otherRecipients])
} }
shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || s1 || s2 shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || s1 || s2