Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

♻️ Move the event invite claim into the merge batch

Luke Vellae0579f23f4db
diff --git a/apps/web/src/features/auth/mutations.ts b/apps/web/src/features/auth/mutations.ts
index 8015a6e15..5e22ec7cf 100644
--- a/apps/web/src/features/auth/mutations.ts
+++ b/apps/web/src/features/auth/mutations.ts
@@ -44,18 +44,6 @@ export const linkAnonymousUser = async (
select: { email: true },
});
- if (authenticatedUser?.email) {
- await prisma.scheduledEventInvite.updateMany({
- where: {
- inviteeId: anonymousUserId,
- inviteeEmail: authenticatedUser.email,
- },
- data: {
- inviteeId: authenticatedUserId,
- },
- });
- }
-
spaceId = await getActiveSpaceForUser({
userId: authenticatedUserId,
});
@@ -83,6 +71,20 @@ export const linkAnonymousUser = async (
// timeout rolled back merges whose commit landed late, and the guest was
// then deleted with everything still on it.
await prisma.$transaction([
+ ...(authenticatedUser?.email
+ ? [
+ prisma.scheduledEventInvite.updateMany({
+ where: {
+ inviteeId: anonymousUserId,
+ inviteeEmail: authenticatedUser.email,
+ },
+ data: {
+ inviteeId: authenticatedUserId,
+ },
+ }),
+ ]
+ : []),
+
// Transfer polls
prisma.poll.updateMany({
where: {