Fix sqlite ban time conversion (#17101)

This commit is contained in:
Leon Friedrich
2023-06-04 06:56:22 +12:00
committed by GitHub
parent 59765e8811
commit 160e3efe00

View File

@@ -312,8 +312,9 @@ namespace Content.Server.Database
uid, uid,
ban.Address, ban.Address,
ban.HWId == null ? null : ImmutableArray.Create(ban.HWId), ban.HWId == null ? null : ImmutableArray.Create(ban.HWId),
ban.BanTime, // SQLite apparently always reads DateTime as unspecified, but we always write as UTC.
ban.ExpirationTime, DateTime.SpecifyKind(ban.BanTime, DateTimeKind.Utc),
ban.ExpirationTime == null ? null : DateTime.SpecifyKind(ban.ExpirationTime.Value, DateTimeKind.Utc),
ban.Reason, ban.Reason,
aUid, aUid,
unban, unban,
@@ -336,7 +337,8 @@ namespace Content.Server.Database
return new ServerRoleUnbanDef( return new ServerRoleUnbanDef(
unban.Id, unban.Id,
aUid, aUid,
unban.UnbanTime); // SQLite apparently always reads DateTime as unspecified, but we always write as UTC.
DateTime.SpecifyKind(unban.UnbanTime, DateTimeKind.Utc));
} }
#endregion #endregion
@@ -377,8 +379,9 @@ namespace Content.Server.Database
uid, uid,
ban.Address, ban.Address,
ban.HWId == null ? null : ImmutableArray.Create(ban.HWId), ban.HWId == null ? null : ImmutableArray.Create(ban.HWId),
ban.BanTime, // SQLite apparently always reads DateTime as unspecified, but we always write as UTC.
ban.ExpirationTime, DateTime.SpecifyKind(ban.BanTime, DateTimeKind.Utc),
ban.ExpirationTime == null ? null : DateTime.SpecifyKind(ban.ExpirationTime.Value, DateTimeKind.Utc),
ban.Reason, ban.Reason,
aUid, aUid,
unban); unban);
@@ -400,7 +403,8 @@ namespace Content.Server.Database
return new ServerUnbanDef( return new ServerUnbanDef(
unban.Id, unban.Id,
aUid, aUid,
unban.UnbanTime); // SQLite apparently always reads DateTime as unspecified, but we always write as UTC.
DateTime.SpecifyKind(unban.UnbanTime, DateTimeKind.Utc));
} }
public override async Task<int> AddConnectionLogAsync( public override async Task<int> AddConnectionLogAsync(