fix invite flow if user use another email than the invited
This commit is contained in:
@@ -8,6 +8,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
if (payload.type === 'user.created') {
|
if (payload.type === 'user.created') {
|
||||||
const email = payload.data.email_addresses[0]?.email_address;
|
const email = payload.data.email_addresses[0]?.email_address;
|
||||||
|
const emails = payload.data.email_addresses.map((e) => e.email_address);
|
||||||
|
|
||||||
if (!email) {
|
if (!email) {
|
||||||
return Response.json(
|
return Response.json(
|
||||||
@@ -27,7 +28,9 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
const memberships = await db.member.findMany({
|
const memberships = await db.member.findMany({
|
||||||
where: {
|
where: {
|
||||||
email,
|
email: {
|
||||||
|
in: emails,
|
||||||
|
},
|
||||||
userId: null,
|
userId: null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user