We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 08954f6 + b98609c commit c129653Copy full SHA for c129653
1 file changed
src/functions/teams/create/handler.ts
@@ -98,6 +98,18 @@ const teamsCreate: ValidatedEventAPIGatewayProxyEvent<typeof schema> = async (ev
98
99
// Validate all member emails exist using user-exists logic
100
const memberEmails = event.body.members.map((email) => email.toLowerCase());
101
+
102
+ // Check if user is trying to invite themselves
103
+ if (memberEmails.includes(event.body.auth_email.toLowerCase())) {
104
+ return {
105
+ statusCode: 400,
106
+ body: JSON.stringify({
107
108
+ message: 'You cannot invite yourself to a team',
109
+ }),
110
+ };
111
+ }
112
113
const invalidEmails = [];
114
const emailsAlreadyInTeams = [];
115
0 commit comments