fix relink when secondary uids are present

This commit is contained in:
rootdarkarchon
2023-07-17 09:06:24 +02:00
parent 6451dec563
commit 715bd87907

View File

@@ -1053,7 +1053,7 @@ public class MareModule : InteractionModuleBase
var existingLodestoneAuth = db.LodeStoneAuth.Include(u => u.User).SingleOrDefault(u => u.DiscordId != cmd.User.Id && u.HashedLodestoneId == lodestoneAuth.HashedLodestoneId); var existingLodestoneAuth = db.LodeStoneAuth.Include(u => u.User).SingleOrDefault(u => u.DiscordId != cmd.User.Id && u.HashedLodestoneId == lodestoneAuth.HashedLodestoneId);
var previousAuth = await db.Auth.FirstOrDefaultAsync(u => u.UserUID == existingLodestoneAuth.User.UID); var previousAuth = await db.Auth.FirstOrDefaultAsync(u => u.UserUID == existingLodestoneAuth.User.UID && string.IsNullOrEmpty(u.PrimaryUserUID));
if (previousAuth != null) if (previousAuth != null)
{ {
db.Auth.Remove(previousAuth); db.Auth.Remove(previousAuth);