feat(FN-4743): complete Step 4 — add mail retention setting UI

Fusion-Task-Id: FN-4743
Fusion-Task-Lineage: 50d1d8e4-66d5-4299-843b-28072a904277
This commit is contained in:
Fusion (runfusion.ai)
2026-05-16 10:27:38 -07:00
committed by gsxdsm
parent 96be8d4cd7
commit 8a521a565d
2 changed files with 49 additions and 0 deletions

View File

@@ -2291,6 +2291,25 @@ export function SettingsModal({
</select>
<small>Delete chat sessions and rooms that have been idle for this many days. Default: Off.</small>
</div>
<div className="form-group">
<label htmlFor="mailAutoCleanupDays">Auto-prune old mail</label>
<select
id="mailAutoCleanupDays"
className="select"
value={form.mailAutoCleanupDays ?? 0}
onChange={(e) =>
setForm((f) => ({ ...f, mailAutoCleanupDays: Number(e.target.value) || 0 }))
}
>
<option value={0}>Off</option>
<option value={7}>7 days</option>
<option value={14}>14 days</option>
<option value={30}>30 days</option>
<option value={60}>60 days</option>
<option value={90}>90 days</option>
</select>
<small>Delete inbox/outbox messages older than this many days. Default: Off. 7 days is the suggested setting.</small>
</div>
<h4 className="settings-section-heading settings-section-heading--spaced">Chat Rooms</h4>
<div className="form-group">
<label htmlFor="chatRoomRecentVerbatimMessages">Recent verbatim room messages</label>

View File

@@ -904,6 +904,36 @@ describe("SettingsModal", () => {
expect(payload.chatAutoCleanupDays).toBe(14);
});
it("renders and saves mail auto-prune retention", async () => {
renderModal({ initialSection: "general" });
await waitForSettingsModalReady();
const mailCleanupSelect = screen.getByLabelText("Auto-prune old mail") as HTMLSelectElement;
expect(mailCleanupSelect.value).toBe("0");
await userEvent.selectOptions(mailCleanupSelect, "7");
await userEvent.click(screen.getByRole("button", { name: "Save" }));
await waitFor(() => {
expect(mockUpdateSettings).toHaveBeenCalled();
});
const payload = mockUpdateSettings.mock.calls[0][0] as Record<string, unknown>;
expect(payload.mailAutoCleanupDays).toBe(7);
mockUpdateSettings.mockClear();
await userEvent.selectOptions(mailCleanupSelect, "0");
await userEvent.click(screen.getByRole("button", { name: "Save" }));
await waitFor(() => {
expect(mockUpdateSettings).toHaveBeenCalled();
});
const offPayload = mockUpdateSettings.mock.calls[0][0] as Record<string, unknown>;
expect(offPayload.mailAutoCleanupDays).toBe(0);
});
it("renders and saves chat room compaction controls", async () => {
renderModal({ initialSection: "general" });
await waitForSettingsModalReady();