God bloody christ. There's like three layers of shit here. So firstly, apparently we were still using Npgsql.EnableLegacyTimestampBehavior. This means that time values (which are stored UTC in the database) were converted to local time when read out. This meant they were passed around as kind Local to clients (instead of UTC in the case of SQLite). That's easy enough to fix just turn off the flag and fix the couple spots we're passing a local DateTime ez. Oh but it turns out there's a DIFFERENT problem with SQLite: See SQLite we definitely store the DateTimes as UTC, but when Microsoft.Data.Sqlite reads them it reads them as Kind Unspecified instead of Utc. Why are these so bad? Because the admin notes system passes DateTime instances from EF Core straight to the rest of the game code. And that means it's a PAIN IN THE ASS to run the necessary conversions to fix the DateTime instances. GOD DAMNIT now I have to make a whole new set of "Record" entities so we avoid leaking the EF Core model entities. WAAAAAAA. Fixes #19897
50 lines
2.3 KiB
C#
50 lines
2.3 KiB
C#
using System.Threading.Tasks;
|
|
using Content.Server.Database;
|
|
using Content.Shared.Administration.Notes;
|
|
using Content.Shared.Database;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Content.Server.Administration.Notes;
|
|
|
|
public interface IAdminNotesManager
|
|
{
|
|
event Action<SharedAdminNote>? NoteAdded;
|
|
event Action<SharedAdminNote>? NoteModified;
|
|
event Action<SharedAdminNote>? NoteDeleted;
|
|
|
|
bool CanCreate(ICommonSession admin);
|
|
bool CanDelete(ICommonSession admin);
|
|
bool CanEdit(ICommonSession admin);
|
|
bool CanView(ICommonSession admin);
|
|
Task OpenEui(ICommonSession admin, Guid notedPlayer);
|
|
Task OpenUserNotesEui(ICommonSession player);
|
|
Task AddAdminRemark(ICommonSession createdBy, Guid player, NoteType type, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime);
|
|
Task DeleteAdminRemark(int noteId, NoteType type, ICommonSession deletedBy);
|
|
Task ModifyAdminRemark(int noteId, NoteType type, ICommonSession editedBy, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime);
|
|
/// <summary>
|
|
/// Queries the database and retrieves all notes, secret and visible
|
|
/// </summary>
|
|
/// <param name="player">Desired player's <see cref="Guid"/></param>
|
|
/// <returns>ALL non-deleted notes, secret or not</returns>
|
|
Task<List<IAdminRemarksRecord>> GetAllAdminRemarks(Guid player);
|
|
/// <summary>
|
|
/// Queries the database and retrieves the notes a player should see
|
|
/// </summary>
|
|
/// <param name="player">Desired player's <see cref="Guid"/></param>
|
|
/// <returns>All player-visible notes</returns>
|
|
Task<List<IAdminRemarksRecord>> GetVisibleRemarks(Guid player);
|
|
/// <summary>
|
|
/// Queries the database and retrieves watchlists that may have been placed on the player
|
|
/// </summary>
|
|
/// <param name="player">Desired player's <see cref="Guid"/></param>
|
|
/// <returns>Active watchlists</returns>
|
|
Task<List<AdminWatchlistRecord>> GetActiveWatchlists(Guid player);
|
|
/// <summary>
|
|
/// Queries the database and retrieves new messages a player has gotten
|
|
/// </summary>
|
|
/// <param name="player">Desired player's <see cref="Guid"/></param>
|
|
/// <returns>All unread messages</returns>
|
|
Task<List<AdminMessageRecord>> GetNewMessages(Guid player);
|
|
Task MarkMessageAsSeen(int id);
|
|
}
|