fix(carousel): re-add own device skip to prevent error 479
Carousel messages in DSM (deviceSentMessage) wrapper cause error 479 on sender's own linked devices. Re-add the skip that prevents sending carousel to own devices. https://claude.ai/code/session_018DkDxsjWzM131jy3ivWjZp
This commit is contained in:
@@ -1125,6 +1125,9 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
const { user: mePnUser } = jidDecode(meId)!
|
const { user: mePnUser } = jidDecode(meId)!
|
||||||
const { user: meLidUser } = meLid ? jidDecode(meLid)! : { user: null }
|
const { user: meLidUser } = meLid ? jidDecode(meLid)! : { user: null }
|
||||||
|
|
||||||
|
// Carousel in DSM wrapper causes error 479 on own devices
|
||||||
|
const isCarouselMsg = isCarouselMessage(message)
|
||||||
|
|
||||||
for (const { user, jid } of devices) {
|
for (const { user, jid } of devices) {
|
||||||
const isExactSenderDevice = jid === meId || (meLid && jid === meLid)
|
const isExactSenderDevice = jid === meId || (meLid && jid === meLid)
|
||||||
if (isExactSenderDevice) {
|
if (isExactSenderDevice) {
|
||||||
@@ -1136,6 +1139,10 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
const isMe = user === mePnUser || user === meLidUser
|
const isMe = user === mePnUser || user === meLidUser
|
||||||
|
|
||||||
if (isMe) {
|
if (isMe) {
|
||||||
|
if (isCarouselMsg) {
|
||||||
|
logger.debug({ jid }, '[CAROUSEL] Skipping own device - DSM carousel causes error 479')
|
||||||
|
continue
|
||||||
|
}
|
||||||
meRecipients.push(jid)
|
meRecipients.push(jid)
|
||||||
} else {
|
} else {
|
||||||
otherRecipients.push(jid)
|
otherRecipients.push(jid)
|
||||||
@@ -1170,7 +1177,8 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
const isParticipantLid = isLidUser(participant!.jid)
|
const isParticipantLid = isLidUser(participant!.jid)
|
||||||
const isMe = areJidsSameUser(participant!.jid, isParticipantLid ? meLid : meId)
|
const isMe = areJidsSameUser(participant!.jid, isParticipantLid ? meLid : meId)
|
||||||
|
|
||||||
const usesDSM = isMe
|
// Skip DSM for carousel - own devices reject it with error 479
|
||||||
|
const usesDSM = isMe && !isCarouselMessage(message)
|
||||||
const encodedMessageToSend = usesDSM
|
const encodedMessageToSend = usesDSM
|
||||||
? encodeWAMessage({
|
? encodeWAMessage({
|
||||||
deviceSentMessage: {
|
deviceSentMessage: {
|
||||||
|
|||||||
Reference in New Issue
Block a user