fix: handle both string and object participant formats in community membership check

main
brobert (aider) 3 months ago
parent 7fa29c823e
commit 3a5991ade5

@ -25,9 +25,15 @@ export async function isUserInCommunity(userJid: string, groupJids: Set<string>)
// Check if user is in this group's participants
const participants = response.data?.participants || [];
console.log('Participants:', participants);
// Check both JID and phone number formats
const userPhone = userJid.split('@')[0];
if (participants.includes(userJid) || participants.some(p => p.startsWith(userPhone))) {
if (participants.some(p => {
// Handle both string and object participant formats
const participantJid = typeof p === 'string' ? p : p?.id;
return participantJid === userJid || participantJid?.startsWith?.(userPhone);
})) {
return true;
}
}

Loading…
Cancel
Save