From fb2ef05172db1023042b3769c0e26f205c449378 Mon Sep 17 00:00:00 2001 From: Brendan Kellam Date: Fri, 20 Jun 2025 12:49:25 -0700 Subject: [PATCH] fix(invites): Fix regression to invite creation (#359) --- CHANGELOG.md | 3 +++ packages/web/src/actions.ts | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 221874f7..42b9e551 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Fixed issue where invites appeared to be created successfully, but were not actually being created in the database. [#359](https://github.com/sourcebot-dev/sourcebot/pull/359) + ## [4.4.0] - 2025-06-18 ### Added diff --git a/packages/web/src/actions.ts b/packages/web/src/actions.ts index 3497e397..e9adbc2a 100644 --- a/packages/web/src/actions.ts +++ b/packages/web/src/actions.ts @@ -1055,6 +1055,15 @@ export const createInvites = async (emails: string[], domain: string): Promise<{ } satisfies ServiceError; } + await prisma.invite.createMany({ + data: emails.map((email) => ({ + recipientEmail: email, + hostUserId: userId, + orgId: org.id, + })), + skipDuplicates: true, + }); + // Send invites to recipients if (env.SMTP_CONNECTION_URL && env.EMAIL_FROM_ADDRESS) { const origin = (await headers()).get('origin')!;