feat(FN-4733): complete Step 4 — add chat cleanup settings UI
Fusion-Task-Id: FN-4733 Fusion-Task-Lineage: 38495ced-c7a0-40aa-be22-7f02fe958806
This commit is contained in:
committed by
gsxdsm
parent
3b6c6b9df5
commit
6fcfbd009b
@@ -2149,6 +2149,26 @@ export function SettingsModal({
|
||||
</label>
|
||||
<small>Show the floating chat button in the dashboard. Chat is still accessible from the Chat tab in the mobile navigation.</small>
|
||||
</div>
|
||||
<h4 className="settings-section-heading settings-section-heading--spaced">Chat history</h4>
|
||||
<div className="form-group">
|
||||
<label htmlFor="chatAutoCleanupDays">Auto-cleanup old chats</label>
|
||||
<select
|
||||
id="chatAutoCleanupDays"
|
||||
className="select"
|
||||
value={form.chatAutoCleanupDays ?? 0}
|
||||
onChange={(e) =>
|
||||
setForm((f) => ({ ...f, chatAutoCleanupDays: 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 chat sessions and rooms that have been idle for this many days. Default: Off.</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>
|
||||
|
||||
@@ -863,6 +863,24 @@ describe("SettingsModal", () => {
|
||||
expect(ephemeralToggle.checked).toBe(true);
|
||||
});
|
||||
|
||||
it("renders and saves chat auto-cleanup retention", async () => {
|
||||
renderModal({ initialSection: "general" });
|
||||
await waitForSettingsModalReady();
|
||||
|
||||
const cleanupSelect = screen.getByLabelText("Auto-cleanup old chats") as HTMLSelectElement;
|
||||
expect(cleanupSelect.value).toBe("0");
|
||||
|
||||
await userEvent.selectOptions(cleanupSelect, "14");
|
||||
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.chatAutoCleanupDays).toBe(14);
|
||||
});
|
||||
|
||||
it("renders and saves chat room compaction controls", async () => {
|
||||
renderModal({ initialSection: "general" });
|
||||
await waitForSettingsModalReady();
|
||||
|
||||
Reference in New Issue
Block a user