From 48cf492fa14914b63c2ee6356717798ea6258170 Mon Sep 17 00:00:00 2001 From: azyges <229218900+azyges@users.noreply.github.com> Date: Fri, 26 Sep 2025 20:25:08 +0900 Subject: [PATCH] remove nullability --- .../LightlessSyncServer/Hubs/LightlessHub.Functions.cs | 6 +++--- .../LightlessSyncServices/Discord/DiscordBot.cs | 8 ++++---- .../Discord/MareWizardModule.Vanity.cs | 4 ++-- .../20250925225205_AddUserVanityFields.Designer.cs | 2 +- .../Migrations/20250925225205_AddUserVanityFields.cs | 2 +- .../Migrations/LightlessDbContextModelSnapshot.cs | 2 +- LightlessSyncServer/LightlessSyncShared/Models/User.cs | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/LightlessSyncServer/LightlessSyncServer/Hubs/LightlessHub.Functions.cs b/LightlessSyncServer/LightlessSyncServer/Hubs/LightlessHub.Functions.cs index 83a2c15..40ca003 100644 --- a/LightlessSyncServer/LightlessSyncServer/Hubs/LightlessHub.Functions.cs +++ b/LightlessSyncServer/LightlessSyncServer/Hubs/LightlessHub.Functions.cs @@ -111,7 +111,7 @@ public partial class LightlessHub return null; } - if (user.HasVanity != true) + if (!user.HasVanity) { _logger.LogCallWarning(LightlessHubLogger.Args("vanity check", uid, "no vanity")); return null; @@ -368,7 +368,7 @@ public partial class LightlessHub resultList[0].OtherPermissions, resultList[0].OtherUserIsAdmin, resultList[0].OtherUserIsModerator, - resultList[0].OtherUserHasVanity ?? false, + resultList[0].OtherUserHasVanity, resultList[0].OtherUserTextColorHex ?? string.Empty, resultList[0].OtherUserTextGlowColorHex ?? string.Empty); } @@ -462,7 +462,7 @@ public partial class LightlessHub g.First().OtherPermissions, g.First().OtherUserIsAdmin, g.First().OtherUserIsModerator, - g.First().OtherUserHasVanity ?? false, + g.First().OtherUserHasVanity, g.First().OtherUserTextColorHex ?? string.Empty, g.First().OtherUserTextGlowColorHex ?? string.Empty); }, StringComparer.Ordinal); diff --git a/LightlessSyncServer/LightlessSyncServices/Discord/DiscordBot.cs b/LightlessSyncServer/LightlessSyncServices/Discord/DiscordBot.cs index ca2e015..4a2951f 100644 --- a/LightlessSyncServer/LightlessSyncServices/Discord/DiscordBot.cs +++ b/LightlessSyncServer/LightlessSyncServices/Discord/DiscordBot.cs @@ -411,7 +411,7 @@ internal class DiscordBot : IHostedService await db.SaveChangesAsync(token).ConfigureAwait(false); } - else if (lodestoneUser?.User != null && lodestoneUser.User.HasVanity != true) + else if (lodestoneUser?.User != null && !lodestoneUser.User.HasVanity) { lodestoneUser.User.HasVanity = true; db.Update(lodestoneUser.User); @@ -421,7 +421,7 @@ internal class DiscordBot : IHostedService foreach (var secondaryUser in secondaryUsers) { - if (secondaryUser.User.HasVanity != true) + if (!secondaryUser.User.HasVanity) { secondaryUser.User.HasVanity = true; db.Update(secondaryUser.User); @@ -464,7 +464,7 @@ internal class DiscordBot : IHostedService var hasChanges = false; - if (lodestoneAuth.User.HasVanity != true) + if (!lodestoneAuth.User.HasVanity) { lodestoneAuth.User.HasVanity = true; db.Update(lodestoneAuth.User); @@ -473,7 +473,7 @@ internal class DiscordBot : IHostedService foreach (var secondaryUser in secondaryUsers) { - if (secondaryUser.User.HasVanity != true) + if (!secondaryUser.User.HasVanity) { secondaryUser.User.HasVanity = true; db.Update(secondaryUser.User); diff --git a/LightlessSyncServer/LightlessSyncServices/Discord/MareWizardModule.Vanity.cs b/LightlessSyncServer/LightlessSyncServices/Discord/MareWizardModule.Vanity.cs index 783bd56..fb075e3 100644 --- a/LightlessSyncServer/LightlessSyncServices/Discord/MareWizardModule.Vanity.cs +++ b/LightlessSyncServer/LightlessSyncServices/Discord/MareWizardModule.Vanity.cs @@ -130,7 +130,7 @@ public partial class LightlessWizardModule foreach (var secondaryUser in secondaryUsers) { - if (secondaryUser.User.HasVanity != true) + if (!secondaryUser.User.HasVanity) { secondaryUser.User.HasVanity = true; db.Update(secondaryUser.User); @@ -225,7 +225,7 @@ public partial class LightlessWizardModule foreach (var secondaryUser in secondaryUsers) { - if (secondaryUser.User.HasVanity != true) + if (!secondaryUser.User.HasVanity) { secondaryUser.User.HasVanity = true; db.Update(secondaryUser.User); diff --git a/LightlessSyncServer/LightlessSyncShared/Migrations/20250925225205_AddUserVanityFields.Designer.cs b/LightlessSyncServer/LightlessSyncShared/Migrations/20250925225205_AddUserVanityFields.Designer.cs index 201cc8b..c667a50 100644 --- a/LightlessSyncServer/LightlessSyncShared/Migrations/20250925225205_AddUserVanityFields.Designer.cs +++ b/LightlessSyncServer/LightlessSyncShared/Migrations/20250925225205_AddUserVanityFields.Designer.cs @@ -686,7 +686,7 @@ namespace LightlessSyncServer.Migrations .HasColumnType("character varying(15)") .HasColumnName("alias"); - b.Property("HasVanity") + b.Property("HasVanity") .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("has_vanity"); diff --git a/LightlessSyncServer/LightlessSyncShared/Migrations/20250925225205_AddUserVanityFields.cs b/LightlessSyncServer/LightlessSyncShared/Migrations/20250925225205_AddUserVanityFields.cs index 0859d55..fbc7b07 100644 --- a/LightlessSyncServer/LightlessSyncShared/Migrations/20250925225205_AddUserVanityFields.cs +++ b/LightlessSyncServer/LightlessSyncShared/Migrations/20250925225205_AddUserVanityFields.cs @@ -14,7 +14,7 @@ namespace LightlessSyncServer.Migrations name: "has_vanity", table: "users", type: "boolean", - nullable: true, + nullable: false, defaultValue: false); migrationBuilder.AddColumn( diff --git a/LightlessSyncServer/LightlessSyncShared/Migrations/LightlessDbContextModelSnapshot.cs b/LightlessSyncServer/LightlessSyncShared/Migrations/LightlessDbContextModelSnapshot.cs index 728a7c8..751cfd6 100644 --- a/LightlessSyncServer/LightlessSyncShared/Migrations/LightlessDbContextModelSnapshot.cs +++ b/LightlessSyncServer/LightlessSyncShared/Migrations/LightlessDbContextModelSnapshot.cs @@ -683,7 +683,7 @@ namespace LightlessSyncServer.Migrations .HasColumnType("character varying(15)") .HasColumnName("alias"); - b.Property("HasVanity") + b.Property("HasVanity") .HasColumnType("boolean") .HasDefaultValue(false) .HasColumnName("has_vanity"); diff --git a/LightlessSyncServer/LightlessSyncShared/Models/User.cs b/LightlessSyncServer/LightlessSyncShared/Models/User.cs index f36fc84..6e7f612 100644 --- a/LightlessSyncServer/LightlessSyncShared/Models/User.cs +++ b/LightlessSyncServer/LightlessSyncShared/Models/User.cs @@ -14,7 +14,7 @@ public class User public bool IsAdmin { get; set; } = false; - public bool? HasVanity { get; set; } = false; + public bool HasVanity { get; set; } = false; [MaxLength(9)] public string? TextColorHex { get; set; } = string.Empty;