From 353596fa4382d3b3f192e7a591974fefe5e7b405 Mon Sep 17 00:00:00 2001 From: JonKazama-Hellion Date: Fri, 1 May 2026 18:52:54 +0200 Subject: [PATCH] Fall back to spec retention defaults before the global default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GetRetentionDays previously dropped straight from a missing user override to RetentionDefaultDays, so every channel showed 30 days in the UI even though the spec lists 365 for Tells and 90 for own- conversation channels. Insert a middle layer: user override → spec default → global default. The retention sweep now seeds its policy from PrivacyDefaults.DefaultRetentionDays first and lets explicit user overrides win on top, and the per-channel UI tags each row as [override], [spec], or [global] so the source of the value is visible without guessing. --- ChatTwo/Configuration.cs | 2 ++ ChatTwo/Plugin.cs | 7 ++++++- ChatTwo/Ui/SettingsTabs/Privacy.cs | 10 ++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs index 67901e7..8b4d18f 100755 --- a/ChatTwo/Configuration.cs +++ b/ChatTwo/Configuration.cs @@ -66,6 +66,8 @@ public class Configuration : IPluginConfiguration { if (RetentionPerChannelDays.TryGetValue(type, out var userOverride)) return userOverride; + if (Privacy.PrivacyDefaults.DefaultRetentionDays.TryGetValue(type, out var specDefault)) + return specDefault; return RetentionDefaultDays; } diff --git a/ChatTwo/Plugin.cs b/ChatTwo/Plugin.cs index 00fc10f..84aef30 100755 --- a/ChatTwo/Plugin.cs +++ b/ChatTwo/Plugin.cs @@ -318,7 +318,12 @@ public sealed class Plugin : IDalamudPlugin return; // Snapshot the policy so the user can edit settings while we run. - var policy = Config.RetentionPerChannelDays.ToDictionary(p => (int)(ushort)p.Key, p => p.Value); + // Spec defaults form the baseline; explicit user overrides win. + var policy = new Dictionary(); + foreach (var (type, days) in Privacy.PrivacyDefaults.DefaultRetentionDays) + policy[(int)(ushort)type] = days; + foreach (var (type, days) in Config.RetentionPerChannelDays) + policy[(int)(ushort)type] = days; var defaultDays = Config.RetentionDefaultDays; new Thread(() => diff --git a/ChatTwo/Ui/SettingsTabs/Privacy.cs b/ChatTwo/Ui/SettingsTabs/Privacy.cs index 36f785e..2ae1fd4 100644 --- a/ChatTwo/Ui/SettingsTabs/Privacy.cs +++ b/ChatTwo/Ui/SettingsTabs/Privacy.cs @@ -190,10 +190,16 @@ internal sealed class Privacy : ISettingsTab foreach (var type in types) { var hasOverride = Mutable.RetentionPerChannelDays.TryGetValue(type, out var days); + var hasSpecDefault = PrivacyDefaults.DefaultRetentionDays.TryGetValue(type, out var specDays); if (!hasOverride) - days = Mutable.RetentionDefaultDays; + days = hasSpecDefault ? specDays : Mutable.RetentionDefaultDays; - if (ImGui.InputInt($"{type}##retention-{(int)type}", ref days)) + var tag = hasOverride + ? "[override]" + : hasSpecDefault + ? "[spec]" + : "[global]"; + if (ImGui.InputInt($"{type} {tag}##retention-{(int)type}", ref days)) { days = Math.Max(0, days); Mutable.RetentionPerChannelDays[type] = days;