remove nullability

This commit is contained in:
azyges
2025-09-26 20:25:08 +09:00
parent 2b05223a4b
commit 48cf492fa1
7 changed files with 13 additions and 13 deletions

View File

@@ -111,7 +111,7 @@ public partial class LightlessHub
return null; return null;
} }
if (user.HasVanity != true) if (!user.HasVanity)
{ {
_logger.LogCallWarning(LightlessHubLogger.Args("vanity check", uid, "no vanity")); _logger.LogCallWarning(LightlessHubLogger.Args("vanity check", uid, "no vanity"));
return null; return null;
@@ -368,7 +368,7 @@ public partial class LightlessHub
resultList[0].OtherPermissions, resultList[0].OtherPermissions,
resultList[0].OtherUserIsAdmin, resultList[0].OtherUserIsAdmin,
resultList[0].OtherUserIsModerator, resultList[0].OtherUserIsModerator,
resultList[0].OtherUserHasVanity ?? false, resultList[0].OtherUserHasVanity,
resultList[0].OtherUserTextColorHex ?? string.Empty, resultList[0].OtherUserTextColorHex ?? string.Empty,
resultList[0].OtherUserTextGlowColorHex ?? string.Empty); resultList[0].OtherUserTextGlowColorHex ?? string.Empty);
} }
@@ -462,7 +462,7 @@ public partial class LightlessHub
g.First().OtherPermissions, g.First().OtherPermissions,
g.First().OtherUserIsAdmin, g.First().OtherUserIsAdmin,
g.First().OtherUserIsModerator, g.First().OtherUserIsModerator,
g.First().OtherUserHasVanity ?? false, g.First().OtherUserHasVanity,
g.First().OtherUserTextColorHex ?? string.Empty, g.First().OtherUserTextColorHex ?? string.Empty,
g.First().OtherUserTextGlowColorHex ?? string.Empty); g.First().OtherUserTextGlowColorHex ?? string.Empty);
}, StringComparer.Ordinal); }, StringComparer.Ordinal);

View File

@@ -411,7 +411,7 @@ internal class DiscordBot : IHostedService
await db.SaveChangesAsync(token).ConfigureAwait(false); 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; lodestoneUser.User.HasVanity = true;
db.Update(lodestoneUser.User); db.Update(lodestoneUser.User);
@@ -421,7 +421,7 @@ internal class DiscordBot : IHostedService
foreach (var secondaryUser in secondaryUsers) foreach (var secondaryUser in secondaryUsers)
{ {
if (secondaryUser.User.HasVanity != true) if (!secondaryUser.User.HasVanity)
{ {
secondaryUser.User.HasVanity = true; secondaryUser.User.HasVanity = true;
db.Update(secondaryUser.User); db.Update(secondaryUser.User);
@@ -464,7 +464,7 @@ internal class DiscordBot : IHostedService
var hasChanges = false; var hasChanges = false;
if (lodestoneAuth.User.HasVanity != true) if (!lodestoneAuth.User.HasVanity)
{ {
lodestoneAuth.User.HasVanity = true; lodestoneAuth.User.HasVanity = true;
db.Update(lodestoneAuth.User); db.Update(lodestoneAuth.User);
@@ -473,7 +473,7 @@ internal class DiscordBot : IHostedService
foreach (var secondaryUser in secondaryUsers) foreach (var secondaryUser in secondaryUsers)
{ {
if (secondaryUser.User.HasVanity != true) if (!secondaryUser.User.HasVanity)
{ {
secondaryUser.User.HasVanity = true; secondaryUser.User.HasVanity = true;
db.Update(secondaryUser.User); db.Update(secondaryUser.User);

View File

@@ -130,7 +130,7 @@ public partial class LightlessWizardModule
foreach (var secondaryUser in secondaryUsers) foreach (var secondaryUser in secondaryUsers)
{ {
if (secondaryUser.User.HasVanity != true) if (!secondaryUser.User.HasVanity)
{ {
secondaryUser.User.HasVanity = true; secondaryUser.User.HasVanity = true;
db.Update(secondaryUser.User); db.Update(secondaryUser.User);
@@ -225,7 +225,7 @@ public partial class LightlessWizardModule
foreach (var secondaryUser in secondaryUsers) foreach (var secondaryUser in secondaryUsers)
{ {
if (secondaryUser.User.HasVanity != true) if (!secondaryUser.User.HasVanity)
{ {
secondaryUser.User.HasVanity = true; secondaryUser.User.HasVanity = true;
db.Update(secondaryUser.User); db.Update(secondaryUser.User);

View File

@@ -686,7 +686,7 @@ namespace LightlessSyncServer.Migrations
.HasColumnType("character varying(15)") .HasColumnType("character varying(15)")
.HasColumnName("alias"); .HasColumnName("alias");
b.Property<bool?>("HasVanity") b.Property<bool>("HasVanity")
.HasColumnType("boolean") .HasColumnType("boolean")
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnName("has_vanity"); .HasColumnName("has_vanity");

View File

@@ -14,7 +14,7 @@ namespace LightlessSyncServer.Migrations
name: "has_vanity", name: "has_vanity",
table: "users", table: "users",
type: "boolean", type: "boolean",
nullable: true, nullable: false,
defaultValue: false); defaultValue: false);
migrationBuilder.AddColumn<string>( migrationBuilder.AddColumn<string>(

View File

@@ -683,7 +683,7 @@ namespace LightlessSyncServer.Migrations
.HasColumnType("character varying(15)") .HasColumnType("character varying(15)")
.HasColumnName("alias"); .HasColumnName("alias");
b.Property<bool?>("HasVanity") b.Property<bool>("HasVanity")
.HasColumnType("boolean") .HasColumnType("boolean")
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnName("has_vanity"); .HasColumnName("has_vanity");

View File

@@ -14,7 +14,7 @@ public class User
public bool IsAdmin { get; set; } = false; public bool IsAdmin { get; set; } = false;
public bool? HasVanity { get; set; } = false; public bool HasVanity { get; set; } = false;
[MaxLength(9)] [MaxLength(9)]
public string? TextColorHex { get; set; } = string.Empty; public string? TextColorHex { get; set; } = string.Empty;