From 7d9ffba29c379be9c7093ed3ca5b7bdd4f3ff083 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Thu, 12 Nov 2026 22:44:07 +0100 Subject: [PATCH] Added setting to enable e-mail on quick alerts. --- components/stashes/heart.vue | 6 ++---- components/user/preferences.vue | 15 +++++++++++++++ src/auth.js | 5 +++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/components/stashes/heart.vue b/components/stashes/heart.vue index a3c8f3f..e845a8c 100644 --- a/components/stashes/heart.vue +++ b/components/stashes/heart.vue @@ -124,10 +124,8 @@ async function alertItem() { ...(props.domain === 'entities' && { entities: [props.item.id] }), ...(props.domain === 'scenes' && { scenes: [props.item.id] }), notify: true, - email: false, - // probably too confusing and annoying to have quick alerts inherit email preference from dialog - // notify: JSON.parse(localStorage.getItem('alert_notify')) ?? true, - // email: JSON.parse(localStorage.getItem('alert_email')) ?? false, + // explicit user preference rather than the dialog's remembered checkbox, which would be too confusing to inherit + email: !!(user.settings?.quickAlertEmails && user.email), preset: true, }, { successFeedback: `Alert set for '${alertLabel}'`, diff --git a/components/user/preferences.vue b/components/user/preferences.vue index fa69a0e..b48dab4 100644 --- a/components/user/preferences.vue +++ b/components/user/preferences.vue @@ -12,6 +12,7 @@ const settings = reactive({ alertNotificationsEnabled: true, alertEmailsEnabled: true, alertEmailsFrequency: null, + quickAlertEmails: false, ...user.settings, }); @@ -53,6 +54,20 @@ async function updateSettings() { +
+ + E-mail quick alerts + Enable e-mail on alerts set with the bell button + + + + + +
+
Alert e-mail frequency diff --git a/src/auth.js b/src/auth.js index 8fa06ca..8da09c4 100755 --- a/src/auth.js +++ b/src/auth.js @@ -580,6 +580,7 @@ const validSettingKeys = [ 'alertNotificationsEnabled', 'alertEmailsEnabled', 'alertEmailsFrequency', + 'quickAlertEmails', ]; export async function updateSettings(settings, reqUser) { @@ -593,6 +594,10 @@ export async function updateSettings(settings, reqUser) { throw new HttpError(`Invalid settings: ${invalidKeys.join()}`, 400); } + if (Object.hasOwn(settings, 'quickAlertEmails') && typeof settings.quickAlertEmails !== 'boolean') { + throw new HttpError('Invalid quick alert e-mails setting', 400); + } + if (settings.alertEmailsFrequency && !['instant', 'daily', 'weekly', 'monthly'].includes(settings.alertEmailsFrequency)) { throw new HttpError('Invalid email frequency setting', 400); }