Merge pull request #258 from SamuelScheit/fix-mobile-send-message

fix: do not send message to self if the device is 0 (mobile)
This commit is contained in:
Alessandro Autiero
2023-07-21 14:39:27 +02:00
committed by GitHub

View File

@@ -427,11 +427,12 @@ export const makeMessagesSocket = (config: SocketConfig) => {
await authState.keys.set({ 'sender-key-memory': { [jid]: senderKeyMap } })
} else {
const { user: meUser } = jidDecode(meId)!
const { user: meUser, device: meDevice } = jidDecode(meId)!
if(!participant) {
devices.push({ user })
devices.push({ user: meUser })
// do not send message to self if the device is 0 (mobile)
if (meDevice != undefined && meDevice !== 0) devices.push({ user: meUser })
const additionalDevices = await getUSyncDevices([ meId, jid ], !!useUserDevicesCache, true)
devices.push(...additionalDevices)