|
|
@ -25,9 +25,15 @@ export async function isUserInCommunity(userJid: string, groupJids: Set<string>)
|
|
|
|
|
|
|
|
|
|
|
|
// Check if user is in this group's participants
|
|
|
|
// Check if user is in this group's participants
|
|
|
|
const participants = response.data?.participants || [];
|
|
|
|
const participants = response.data?.participants || [];
|
|
|
|
|
|
|
|
console.log('Participants:', participants);
|
|
|
|
|
|
|
|
|
|
|
|
// Check both JID and phone number formats
|
|
|
|
// Check both JID and phone number formats
|
|
|
|
const userPhone = userJid.split('@')[0];
|
|
|
|
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;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|