diff --git a/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs b/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs index 857ecbd9e702c..e4f276a6b8ece 100644 --- a/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs +++ b/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs @@ -436,11 +436,17 @@ public void SetPlayer(Guid playerId, string playerUsername) UpdateLogs(); } + /// + /// Creates new player-filter buttons for the UI + /// + /// The dictionary of players public void SetPlayers(Dictionary players) { var buttons = new SortedSet(_adminLogPlayerButtonComparer); var allSelected = true; + // Go through player-filter buttons that already exist on this instance of the UI, and remove their respective players from the dictionary + // When the window first opens, no player-filter buttons exist on it, and so this loop is skipped foreach (var control in PlayersContainer.Children.ToArray()) { if (control is not AdminLogPlayerButton player) @@ -455,6 +461,7 @@ public void SetPlayers(Dictionary players) buttons.Add(player); } + // Create player-filter buttons for players that remain in the dictionary foreach (var (id, name) in players) { var button = new AdminLogPlayerButton(id) @@ -471,6 +478,7 @@ public void SetPlayers(Dictionary players) buttons.Add(button); } + // Refresh the container's children. Add any new buttons that were added since the last refresh PlayersContainer.RemoveAllChildren(); foreach (var player in buttons) diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.cs b/Content.Server/Administration/Systems/AdminVerbSystem.cs index 3cc5cae84788e..d513982c8afad 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.cs @@ -314,7 +314,10 @@ private void AddAdminVerbs(GetVerbsEvent args) { var ui = new AdminLogsEui(); _euiManager.OpenEui(ui, player); - ui.SetLogFilter(player: (targetPlayerSession.UserId.UserId, targetPlayerSession.Name)); + + // TODO Remove search input once player filter actually works + var search = MetaData(targetPlayer).EntityName; + ui.SetLogFilter(search: search, player: (targetPlayerSession.UserId.UserId, targetPlayerSession.Name)); }, Impact = LogImpact.Low };