Merge pull request #504 from jesperordrup/main

Fix: error message https://github.com/coollabsio/coolify/issues/502
This commit is contained in:
Andras Bacsai 2022-07-20 11:50:43 +02:00 committed by GitHub
commit 9a0a145374
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -273,11 +273,15 @@ export async function inviteToTeam(request: FastifyRequest<InviteToTeam>, reply:
const { email, permission, teamId, teamName } = request.body;
const userFound = await prisma.user.findUnique({ where: { email } });
if (!userFound) {
throw `No user found with '${email}' email address.`
throw {
message: `No user found with '${email}' email address.`
};
}
const uid = userFound.id;
if (uid === userId) {
throw `Invitation to yourself? Whaaaaat?`
if (uid === userId) {
throw {
message: `Invitation to yourself? Whaaaaat?`
};
}
const alreadyInTeam = await prisma.team.findFirst({
where: { id: teamId, users: { some: { id: uid } } }