mirror of
https://github.com/lukevella/rallly.git
synced 2025-08-06 01:48:32 +02:00
🐛 Fix user not found warning when merging guest user (#1752)
This commit is contained in:
parent
faf0d73972
commit
07e99b77ca
1 changed files with 5 additions and 4 deletions
|
@ -120,9 +120,9 @@ const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isNewUser = !user.role && profile;
|
const isNewUserFromOAuth = !user.role && profile;
|
||||||
// Check for new user login with OAuth provider
|
// Check for new user login with OAuth provider
|
||||||
if (isNewUser) {
|
if (isNewUserFromOAuth) {
|
||||||
// If role isn't set than the user doesn't exist yet
|
// If role isn't set than the user doesn't exist yet
|
||||||
// This can happen if logging in with an OAuth provider
|
// This can happen if logging in with an OAuth provider
|
||||||
const instanceSettings = await getInstanceSettings();
|
const instanceSettings = await getInstanceSettings();
|
||||||
|
@ -132,8 +132,9 @@ const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isNewUser && user.id) {
|
// If this is an existing registered user
|
||||||
// merge guest user into newly logged in user
|
if (user.id && user.role && user.email) {
|
||||||
|
// merge guest user into existing user
|
||||||
const session = await auth();
|
const session = await auth();
|
||||||
if (session?.user && !session.user.email) {
|
if (session?.user && !session.user.email) {
|
||||||
await mergeGuestsIntoUser(user.id, [session.user.id]);
|
await mergeGuestsIntoUser(user.id, [session.user.id]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue