Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
📈 Alias anonymous user with the user (#1517)
Luke Vellac8b7093d89b0
diff --git a/apps/web/src/auth/merge-user.ts b/apps/web/src/auth/merge-user.tsindex 00b309950..8835084d1 100644--- a/apps/web/src/auth/merge-user.ts+++ b/apps/web/src/auth/merge-user.ts@@ -1,4 +1,5 @@import { prisma } from "@rallly/database";+import { posthog } from "@rallly/posthog/server";import * as Sentry from "@sentry/nextjs";export const mergeGuestsIntoUser = async (@@ -6,7 +7,7 @@ export const mergeGuestsIntoUser = async (guestIds: string[],) => {try {- return await prisma.$transaction(async (tx) => {+ await prisma.$transaction(async (tx) => {await Promise.all([tx.poll.updateMany({where: {@@ -45,6 +46,7 @@ export const mergeGuestsIntoUser = async (}),]);});+ posthog?.alias({ distinctId: userId, alias: guestIds[0] });} catch (error) {Sentry.captureException(error);}