Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🐛 Fix user not found warning when merging guest user (#1752)
Luke Vella07e99b77ca46
diff --git a/apps/web/src/next-auth.ts b/apps/web/src/next-auth.tsindex b7b7fb023..94bbba025 100644--- a/apps/web/src/next-auth.ts+++ b/apps/web/src/next-auth.ts@@ -120,9 +120,9 @@ const {}}- const isNewUser = !user.role && profile;+ const isNewUserFromOAuth = !user.role && profile;// Check for new user login with OAuth provider- if (isNewUser) {+ if (isNewUserFromOAuth) {// If role isn't set than the user doesn't exist yet// This can happen if logging in with an OAuth providerconst instanceSettings = await getInstanceSettings();@@ -132,8 +132,9 @@ const {}}- if (!isNewUser && user.id) {- // merge guest user into newly logged in user+ // If this is an existing registered user+ if (user.id && user.role && user.email) {+ // merge guest user into existing userconst session = await auth();if (session?.user && !session.user.email) {await mergeGuestsIntoUser(user.id, [session.user.id]);