From 81b68a1681b7de7c041ce7a1c52d9a8661a1df30 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Tue, 18 Aug 2026 11:19:32 +0200 Subject: [PATCH] fix(settings): stop drawing the same privacy options in two tabs Three settings were rendered in two places at once, and the third is the one that matters: the entire 89-entry channel grid existed twice. ChatTab's "Channel filter" section and DataPrivacyTab's "Privacy filter" section wrote the same HashSet through near-identical code, differing only in the ImGui id suffix. Whichever one the user found first, the other silently showed the same state. ChatTab's section is gone entirely. DataPrivacyTab is a proper superset of it -- it additionally carries PrivacyPersistUnknownChannels -- so nothing is lost. PrintChangelog keeps only its General entry, where it belongs: it is start-up behaviour, not privacy. The lock-ordering comment moved before the deletion. DataPrivacyTab's version was "see ChatTab for the ordering", a cross-reference to the file being removed; the actual reasoning only existed in ChatTab. --- .../Ui/Components/Settings/Tabs/ChatTab.cs | 39 ------------------- .../Settings/Tabs/DataPrivacyTab.cs | 8 +--- 2 files changed, 2 insertions(+), 45 deletions(-) diff --git a/HellionChat/Ui/Components/Settings/Tabs/ChatTab.cs b/HellionChat/Ui/Components/Settings/Tabs/ChatTab.cs index ae89425..3081efb 100644 --- a/HellionChat/Ui/Components/Settings/Tabs/ChatTab.cs +++ b/HellionChat/Ui/Components/Settings/Tabs/ChatTab.cs @@ -47,16 +47,6 @@ internal sealed class ChatTab DrawNameFormCombo(); } - if (ImGui.CollapsingHeader("Channel filter")) - { - DrawToggle( - "Privacy filter enabled", - () => Plugin.Config.PrivacyFilterEnabled, - v => Plugin.Config.PrivacyFilterEnabled = v - ); - DrawPrivacyPersistChannels(); - } - if (ImGui.CollapsingHeader("Command help")) { DrawCommandHelpSideCombo(); @@ -73,35 +63,6 @@ internal sealed class ChatTab } } - private void DrawPrivacyPersistChannels() - { - // Enum.GetValues gives a stable order; HashSet membership is the source - // of truth, so we toggle via Add/Remove instead of mutating a copy. - ImGui.TextUnformatted("Persist channels:"); - foreach (var ct in Enum.GetValues()) - { - var label = ct.ToString(); - var present = Plugin.Config.PrivacyPersistChannels.Contains(ct); - if (ImGui.Checkbox($"{label}##persist-{label}", ref present)) - { - // Lock closes before SaveConfig: taking ConfigMapsLock across a save - // would invert the lock order (SaveConfig can reach TabsListLock). - lock (_plugin.ConfigMapsLock) - { - if (present) - { - Plugin.Config.PrivacyPersistChannels.Add(ct); - } - else - { - Plugin.Config.PrivacyPersistChannels.Remove(ct); - } - } - _plugin.SaveConfig(); - } - } - } - private void DrawCommandHelpSideCombo() { var current = Plugin.Config.CommandHelpSide; diff --git a/HellionChat/Ui/Components/Settings/Tabs/DataPrivacyTab.cs b/HellionChat/Ui/Components/Settings/Tabs/DataPrivacyTab.cs index 403be48..6e83f84 100644 --- a/HellionChat/Ui/Components/Settings/Tabs/DataPrivacyTab.cs +++ b/HellionChat/Ui/Components/Settings/Tabs/DataPrivacyTab.cs @@ -16,11 +16,6 @@ internal sealed class DataPrivacyTab { if (ImGui.CollapsingHeader("Logging", ImGuiTreeNodeFlags.DefaultOpen)) { - DrawToggle( - "Print changelog on update", - () => Plugin.Config.PrintChangelog, - v => Plugin.Config.PrintChangelog = v - ); DrawToggle( "Enable retention sweep", () => Plugin.Config.RetentionEnabled, @@ -81,7 +76,8 @@ internal sealed class DataPrivacyTab var present = Plugin.Config.PrivacyPersistChannels.Contains(ct); if (ImGui.Checkbox($"{label}##privacy-persist-{label}", ref present)) { - // Lock closes before the save below, see ChatTab for the ordering. + // Lock closes before SaveConfig: taking ConfigMapsLock across a save + // would invert the lock order (SaveConfig can reach TabsListLock). lock (_plugin.ConfigMapsLock) { if (present)