From c8b7093d89b022c395d770e05fbdf24c5d14b9e6 Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Sun, 26 Jan 2025 22:50:57 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=88=20Alias=20anonymous=20user=20with?= =?UTF-8?q?=20the=20user=20(#1517)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/auth/merge-user.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web/src/auth/merge-user.ts b/apps/web/src/auth/merge-user.ts index 00b30995067..8835084d1e0 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); }