Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

checking if the invitee already has the project

Blue Mousef2630c0e9c3a
diff --git a/src/project/project.controller.ts b/src/project/project.controller.ts
index 890b4d037..4d6d2e8d1 100644
--- a/src/project/project.controller.ts
+++ b/src/project/project.controller.ts
@@ -559,7 +559,16 @@ export class ProjectController {
throw new BadRequestException('You cannot share with yourself')
}
- // TODO: Check if the invitee already has the project
+ const isSharingWithUser = !_isEmpty(await this.projectService.findShare({
+ where: {
+ project: project.id,
+ user: invitee.id,
+ },
+ }))
+
+ if (isSharingWithUser) {
+ throw new BadRequestException(`You're already sharing the project with ${invitee.email}`)
+ }
try {
const share = new ProjectShare()