Make customer upload-confirmation email opt-out via settings

New smtp_notify_customer toggle in the SMTP section. Defaults to true
to preserve existing behavior. When unchecked, customers no longer
receive the upload summary even if they have an email on file; staff
and (optionally) admins keep getting their notifications.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Hacker
2026-04-16 13:52:39 +02:00
parent 20e61aa61c
commit 2b1417ccf3
3 changed files with 13 additions and 1 deletions
+3
View File
@@ -272,6 +272,7 @@ api.get('/settings', auth.requireAdmin, (req, res) => {
smtp_pass_set: !!settings.get('smtp_pass', ''),
smtp_from: settings.get('smtp_from', ''),
smtp_notify_admin: settings.get('smtp_notify_admin', 'false') === 'true',
smtp_notify_customer: settings.get('smtp_notify_customer', 'true') === 'true',
});
});
@@ -301,6 +302,8 @@ api.put('/settings', auth.requireAdmin, (req, res) => {
if (b.smtp_from !== undefined) settings.set('smtp_from', String(b.smtp_from || '').trim());
if (b.smtp_notify_admin !== undefined)
settings.set('smtp_notify_admin', b.smtp_notify_admin ? 'true' : 'false');
if (b.smtp_notify_customer !== undefined)
settings.set('smtp_notify_customer', b.smtp_notify_customer ? 'true' : 'false');
res.json({ ok: true });
});
+2 -1
View File
@@ -15,7 +15,8 @@ function fmtSize(n) {
function recipientsFor(customer) {
const out = [];
if (customer.email) out.push({ kind: 'customer', to: customer.email });
const notifyCustomer = settings.get('smtp_notify_customer', 'true') === 'true';
if (notifyCustomer && customer.email) out.push({ kind: 'customer', to: customer.email });
// Staff assigned to this customer (with email)
const staff = db.prepare(`