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.
This commit is contained in:
@@ -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<ChatType>())
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user