From 600bd1893e51c15f889c2c02959033aca270984d Mon Sep 17 00:00:00 2001 From: Stanley Dimant Date: Sat, 21 Dec 2024 18:00:59 +0100 Subject: [PATCH] fix group vanity gid cleanup --- .../MareSynchronosServices/Discord/DiscordBot.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MareSynchronosServer/MareSynchronosServices/Discord/DiscordBot.cs b/MareSynchronosServer/MareSynchronosServices/Discord/DiscordBot.cs index d0ce47f..48da008 100644 --- a/MareSynchronosServer/MareSynchronosServices/Discord/DiscordBot.cs +++ b/MareSynchronosServer/MareSynchronosServices/Discord/DiscordBot.cs @@ -265,10 +265,10 @@ internal class DiscordBot : IHostedService private async Task CheckVanityForGroup(RestGuild restGuild, Dictionary allowedRoleIds, MareDbContext db, Group group, CancellationToken token) { var groupPrimaryUser = group.OwnerUID; - var primaryUser = await db.Auth.Include(u => u.User).SingleOrDefaultAsync(u => u.PrimaryUserUID == group.OwnerUID).ConfigureAwait(false); - if (primaryUser != null) + var groupOwner = await db.Auth.Include(u => u.User).SingleOrDefaultAsync(u => u.UserUID == group.OwnerUID).ConfigureAwait(false); + if (groupOwner != null && !string.IsNullOrEmpty(groupOwner.PrimaryUserUID)) { - groupPrimaryUser = primaryUser.User.UID; + groupPrimaryUser = groupOwner.PrimaryUserUID; } var lodestoneUser = await db.LodeStoneAuth.Include(u => u.User).SingleOrDefaultAsync(f => f.User.UID == groupPrimaryUser).ConfigureAwait(false);