mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-31 06:59:07 +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
|
||||
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 provider
|
||||
const 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 user
|
||||
const session = await auth();
|
||||
if (session?.user && !session.user.email) {
|
||||
await mergeGuestsIntoUser(user.id, [session.user.id]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue