Better notes and bans (#14228)

Co-authored-by: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com>
This commit is contained in:
Riggle
2023-07-21 13:38:52 +02:00
committed by GitHub
parent c6cb6ad928
commit 579913b617
84 changed files with 9820 additions and 886 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Eui;
using Content.Shared.Database;
using Content.Shared.Eui;
using Robust.Shared.Serialization;
namespace Content.Shared.Administration.Notes;
@@ -6,7 +7,7 @@ namespace Content.Shared.Administration.Notes;
[Serializable, NetSerializable]
public sealed class AdminNotesEuiState : EuiStateBase
{
public AdminNotesEuiState(string notedPlayerName, Dictionary<int, SharedAdminNote> notes, bool canCreate, bool canDelete, bool canEdit)
public AdminNotesEuiState(string notedPlayerName, Dictionary<(int, NoteType), SharedAdminNote> notes, bool canCreate, bool canDelete, bool canEdit)
{
NotedPlayerName = notedPlayerName;
Notes = notes;
@@ -16,7 +17,7 @@ public sealed class AdminNotesEuiState : EuiStateBase
}
public string NotedPlayerName { get; }
public Dictionary<int, SharedAdminNote> Notes { get; }
public Dictionary<(int noteId, NoteType noteType), SharedAdminNote> Notes { get; }
public bool CanCreate { get; }
public bool CanDelete { get; }
public bool CanEdit { get; }
@@ -27,35 +28,53 @@ public static class AdminNoteEuiMsg
[Serializable, NetSerializable]
public sealed class CreateNoteRequest : EuiMessageBase
{
public CreateNoteRequest(string message)
public CreateNoteRequest(NoteType type, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime)
{
NoteType = type;
Message = message;
NoteSeverity = severity;
Secret = secret;
ExpiryTime = expiryTime;
}
public NoteType NoteType { get; set; }
public string Message { get; set; }
public NoteSeverity? NoteSeverity { get; set; }
public bool Secret { get; set; }
public DateTime? ExpiryTime { get; set; }
}
[Serializable, NetSerializable]
public sealed class DeleteNoteRequest : EuiMessageBase
{
public DeleteNoteRequest(int id)
public DeleteNoteRequest(int id, NoteType type)
{
Id = id;
Type = type;
}
public int Id { get; set; }
public NoteType Type { get; set; }
}
[Serializable, NetSerializable]
public sealed class EditNoteRequest : EuiMessageBase
{
public EditNoteRequest(int id, string message)
public EditNoteRequest(int id, NoteType type, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime)
{
Id = id;
Type = type;
Message = message;
NoteSeverity = severity;
Secret = secret;
ExpiryTime = expiryTime;
}
public int Id { get; set; }
public NoteType Type { get; set; }
public string Message { get; set; }
public NoteSeverity? NoteSeverity { get; set; }
public bool Secret { get; set; }
public DateTime? ExpiryTime { get; set; }
}
}