diff --git a/Content.Server/Administration/Notes/AdminNotesEui.cs b/Content.Server/Administration/Notes/AdminNotesEui.cs index da6286a252..5aadd1520e 100644 --- a/Content.Server/Administration/Notes/AdminNotesEui.cs +++ b/Content.Server/Administration/Notes/AdminNotesEui.cs @@ -117,13 +117,19 @@ public sealed class AdminNotesEui : BaseEui private void NoteModified(SharedAdminNote note) { + if (note.Player != NotedPlayer) + return; + Notes[note.Id] = note; StateDirty(); } - private void NoteDeleted(int id) + private void NoteDeleted(SharedAdminNote note) { - Notes.Remove(id); + if (note.Player != NotedPlayer) + return; + + Notes.Remove(note.Id); StateDirty(); } diff --git a/Content.Server/Administration/Notes/AdminNotesExtensions.cs b/Content.Server/Administration/Notes/AdminNotesExtensions.cs index 12d35c6202..c8ef366510 100644 --- a/Content.Server/Administration/Notes/AdminNotesExtensions.cs +++ b/Content.Server/Administration/Notes/AdminNotesExtensions.cs @@ -10,6 +10,7 @@ public static class AdminNotesExtensions return new SharedAdminNote( note.Id, note.RoundId, + note.PlayerUserId, note.Message, note.CreatedBy.LastSeenUserName, note.LastEditedBy.LastSeenUserName, diff --git a/Content.Server/Administration/Notes/AdminNotesManager.cs b/Content.Server/Administration/Notes/AdminNotesManager.cs index 2ef1508084..dca26e009f 100644 --- a/Content.Server/Administration/Notes/AdminNotesManager.cs +++ b/Content.Server/Administration/Notes/AdminNotesManager.cs @@ -22,7 +22,7 @@ public sealed class AdminNotesManager : IAdminNotesManager, IPostInjectInit public event Action? NoteAdded; public event Action? NoteModified; - public event Action? NoteDeleted; + public event Action? NoteDeleted; private ISawmill _sawmill = default!; @@ -66,6 +66,7 @@ public sealed class AdminNotesManager : IAdminNotesManager, IPostInjectInit var note = new SharedAdminNote( noteId, round, + player, message, createdBy.Name, createdBy.Name, @@ -89,7 +90,17 @@ public sealed class AdminNotesManager : IAdminNotesManager, IPostInjectInit var deletedAt = DateTime.UtcNow; await _db.DeleteAdminNote(noteId, deletedBy.UserId, deletedAt); - NoteDeleted?.Invoke(noteId); + var sharedNote = new SharedAdminNote( + noteId, + note.RoundId, + note.PlayerUserId, + note.Message, + note.CreatedBy.LastSeenUserName, + note.LastEditedBy.LastSeenUserName, + note.CreatedAt, + note.LastEditedAt + ); + NoteDeleted?.Invoke(sharedNote); } public async Task ModifyNote(int noteId, IPlayerSession editedBy, string message) @@ -110,6 +121,7 @@ public sealed class AdminNotesManager : IAdminNotesManager, IPostInjectInit var sharedNote = new SharedAdminNote( noteId, note.RoundId, + note.PlayerUserId, message, note.CreatedBy.LastSeenUserName, editedBy.Name, diff --git a/Content.Server/Administration/Notes/IAdminNotesManager.cs b/Content.Server/Administration/Notes/IAdminNotesManager.cs index ae4e7712b2..ec48eaea47 100644 --- a/Content.Server/Administration/Notes/IAdminNotesManager.cs +++ b/Content.Server/Administration/Notes/IAdminNotesManager.cs @@ -9,7 +9,7 @@ public interface IAdminNotesManager { event Action? NoteAdded; event Action? NoteModified; - event Action? NoteDeleted; + event Action? NoteDeleted; bool CanCreate(IPlayerSession admin); bool CanDelete(IPlayerSession admin); diff --git a/Content.Shared/Administration/Notes/SharedAdminNote.cs b/Content.Shared/Administration/Notes/SharedAdminNote.cs index 4f3e60c5d4..aa15f65412 100644 --- a/Content.Shared/Administration/Notes/SharedAdminNote.cs +++ b/Content.Shared/Administration/Notes/SharedAdminNote.cs @@ -3,4 +3,4 @@ namespace Content.Shared.Administration.Notes; [Serializable, NetSerializable] -public sealed record SharedAdminNote(int Id, int? Round, string Message, string CreatedByName, string EditedByName, DateTime CreatedAt, DateTime LastEditedAt); +public sealed record SharedAdminNote(int Id, int? Round, Guid Player, string Message, string CreatedByName, string EditedByName, DateTime CreatedAt, DateTime LastEditedAt);