From 9094695a5821dc6826729d940f3651d47bc4fc3d Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Sun, 13 Aug 2023 18:53:48 -0700 Subject: [PATCH] Fix new players added to admin logs always defaulting to selected (#19104) --- .../UI/Logs/AdminLogsControl.xaml.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs b/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs index 665b8eced0..7f779dd2f8 100644 --- a/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs +++ b/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs @@ -420,14 +420,18 @@ public sealed partial class AdminLogsControl : Control public void SetPlayers(Dictionary players) { var buttons = new SortedSet(_adminLogPlayerButtonComparer); + var allSelected = true; foreach (var control in PlayersContainer.Children.ToArray()) { - if (control is not AdminLogPlayerButton player || - !players.Remove(player.Id)) - { + if (control is not AdminLogPlayerButton player) + continue; + + if (!SelectedPlayers.Contains(player.Id)) + allSelected = false; + + if (!players.Remove(player.Id)) continue; - } buttons.Add(player); } @@ -437,10 +441,12 @@ public sealed partial class AdminLogsControl : Control var button = new AdminLogPlayerButton(id) { Text = name, - Pressed = true + Pressed = allSelected }; - SelectedPlayers.Add(id); + if (allSelected) + SelectedPlayers.Add(id); + button.OnPressed += PlayerButtonPressed; buttons.Add(button);