feat(email): hold relationship mail to business hours

queueEmail gains options.respectBusinessHours: snaps the send time to the
next open business-hours block (from now), only deferring when it actually
falls outside hours. Applied to dunning reminders + gallery-expiry warnings;
transactional/admin-initiated mail stays immediate. No-op until business
hours are configured.
This commit is contained in:
Luca
2026-06-02 19:44:04 +02:00
parent 626ab45e0b
commit b378ad679f
3 changed files with 35 additions and 13 deletions
+3 -1
View File
@@ -2650,7 +2650,9 @@ async function applyReminder(invoice, lineItems, level, adminId) {
contentPath: pdfPath,
contentType: 'application/pdf',
}],
});
// Dunning reminders are relationship mail — hold to business hours so
// the customer isn't pinged overnight (no-op unless hours configured).
}, { respectBusinessHours: true });
try {
await logActivity('invoice_reminder_sent', { invoiceId: invoice.id, level, lateFeeMinor },