Fall back to spec retention defaults before the global default
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -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<int, int>();
|
||||
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(() =>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user