fix(collab): 🐛 Shared typebot case sensitivity
This commit is contained in:
@ -91,8 +91,7 @@ const parseWhereFilter = (
|
|||||||
collaborators: {
|
collaborators: {
|
||||||
some: {
|
some: {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
type:
|
type: type === 'write' ? CollaborationType.WRITE : undefined,
|
||||||
type === 'write' ? CollaborationType.WRITE : CollaborationType.READ,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -31,14 +31,17 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
| undefined) ?? {}
|
| undefined) ?? {}
|
||||||
if (!email || !type) return badRequest(res)
|
if (!email || !type) return badRequest(res)
|
||||||
const existingUser = await prisma.user.findUnique({
|
const existingUser = await prisma.user.findUnique({
|
||||||
where: { email },
|
where: { email: email.toLowerCase() },
|
||||||
select: { id: true },
|
select: { id: true },
|
||||||
})
|
})
|
||||||
if (existingUser)
|
if (existingUser)
|
||||||
await prisma.collaboratorsOnTypebots.create({
|
await prisma.collaboratorsOnTypebots.create({
|
||||||
data: { type, typebotId, userId: existingUser.id },
|
data: { type, typebotId, userId: existingUser.id },
|
||||||
})
|
})
|
||||||
else await prisma.invitation.create({ data: { email, type, typebotId } })
|
else
|
||||||
|
await prisma.invitation.create({
|
||||||
|
data: { email: email.toLowerCase(), type, typebotId },
|
||||||
|
})
|
||||||
if (isNotDefined(process.env.NEXT_PUBLIC_E2E_TEST))
|
if (isNotDefined(process.env.NEXT_PUBLIC_E2E_TEST))
|
||||||
await sendEmailNotification({
|
await sendEmailNotification({
|
||||||
to: email,
|
to: email,
|
||||||
|
Reference in New Issue
Block a user