diff --git a/frontend/src/views/SettingsView.vue b/frontend/src/views/SettingsView.vue index 81d9b57..eeeba59 100644 --- a/frontend/src/views/SettingsView.vue +++ b/frontend/src/views/SettingsView.vue @@ -16,6 +16,9 @@ const savingTimezone = ref(false); const timezoneSaved = ref(false); const autoConsolidateTasks = ref(true); const savingAutoConsolidate = ref(false); +const trashRetentionDays = ref("90"); +const savingRetention = ref(false); +const retentionSaved = ref(false); async function saveAutoConsolidate() { savingAutoConsolidate.value = true; @@ -52,6 +55,22 @@ async function saveTimezone() { savingTimezone.value = false; } } + +async function saveRetention() { + const n = Math.max(0, Math.floor(Number(trashRetentionDays.value) || 0)); + trashRetentionDays.value = String(n); + savingRetention.value = true; + retentionSaved.value = false; + try { + await apiPut('/api/settings', { trash_retention_days: String(n) }); + retentionSaved.value = true; + setTimeout(() => (retentionSaved.value = false), 2000); + } catch { + toastStore.show('Failed to save retention setting', 'error'); + } finally { + savingRetention.value = false; + } +} const newEmail = ref(""); const emailPassword = ref(""); const changingEmail = ref(false); @@ -383,6 +402,7 @@ onMounted(async () => { // Load notification preferences from user settings const allSettings = await apiGet>("/api/settings"); userTimezone.value = allSettings.user_timezone ?? ""; + trashRetentionDays.value = allSettings.trash_retention_days ?? "90"; // Default true if unset; explicit "false" disables auto-consolidation. autoConsolidateTasks.value = (allSettings.auto_consolidate_tasks ?? "true") !== "false"; if (allSettings.notify_task_reminders !== undefined) { @@ -1021,6 +1041,31 @@ function formatUserDate(iso: string): string { + +
+

Trash retention

+

Deleted items move to Trash and can be restored. They're permanently purged after this many days.

+
+ + +

Set to 0 to keep deleted items forever (never auto-purge).

+
+
+ + Saved! +
+
+