Better notes and bans (#14228)
Co-authored-by: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com>
This commit is contained in:
39
Content.Shared/Administration/Notes/AdminMessageEuiState.cs
Normal file
39
Content.Shared/Administration/Notes/AdminMessageEuiState.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Eui;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Administration.Notes;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class AdminMessageEuiState : EuiStateBase
|
||||
{
|
||||
public float Time { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string AdminName { get; set; }
|
||||
public DateTime AddedOn { get; set; }
|
||||
|
||||
public AdminMessageEuiState(float time, string message, string adminName, DateTime addedOn)
|
||||
{
|
||||
Message = message;
|
||||
Time = time;
|
||||
AdminName = adminName;
|
||||
AddedOn = addedOn;
|
||||
}
|
||||
}
|
||||
|
||||
public static class AdminMessageEuiMsg
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class Accept : EuiMessageBase
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class Dismiss : EuiMessageBase
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
using Robust.Shared.Serialization;
|
||||
using Content.Shared.Database;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Administration.Notes;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed record SharedAdminNote(int Id, int? Round, Guid Player, string Message, string CreatedByName, string EditedByName, DateTime CreatedAt, DateTime LastEditedAt);
|
||||
public sealed record SharedAdminNote(
|
||||
int Id, // Id of note, message, watchlist, ban or role ban. Should be paired with NoteType to uniquely identify a shared admin note.
|
||||
Guid Player, // Notes player
|
||||
int? Round, // Which round was it added in?
|
||||
string? ServerName, // Which server was this added on?
|
||||
TimeSpan PlaytimeAtNote, // Playtime at the time of getting the note
|
||||
NoteType NoteType, // Type of note
|
||||
string Message, // Attached message
|
||||
NoteSeverity? NoteSeverity, // Severity of the note, ban or role ban. Otherwise null.
|
||||
bool Secret, // Is it visible to the player (only relevant if players can see their own notes)
|
||||
string CreatedByName, // Who created it?
|
||||
string EditedByName, // Who edited it last?
|
||||
DateTime CreatedAt, // When was it created?
|
||||
DateTime? LastEditedAt, // When was it last edited?
|
||||
DateTime? ExpiryTime, // Does it expire?
|
||||
string[]? BannedRoles, // Only valid for role bans. List of banned roles
|
||||
DateTime? UnbannedTime, // Only valid for bans. Set if unbanned
|
||||
string? UnbannedByName, // Only valid for bans. Set if unbanned
|
||||
bool? Seen // Only valid for messages, otherwise should be null. Has the user seen this message?
|
||||
);
|
||||
|
||||
15
Content.Shared/Administration/Notes/UserNotesEuiState.cs
Normal file
15
Content.Shared/Administration/Notes/UserNotesEuiState.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Eui;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Administration.Notes;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class UserNotesEuiState : EuiStateBase
|
||||
{
|
||||
public UserNotesEuiState(Dictionary<(int, NoteType), SharedAdminNote> notes)
|
||||
{
|
||||
Notes = notes;
|
||||
}
|
||||
public Dictionary<(int, NoteType), SharedAdminNote> Notes { get; }
|
||||
}
|
||||
Reference in New Issue
Block a user