From a5d065e5ecd4e57d4922aba926052d26ee0cd7d2 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 22 Oct 2025 23:48:12 +0200 Subject: [PATCH] chore: Annotate delayed notifs (#10447) --- server/emails/templates/BaseEmail.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/emails/templates/BaseEmail.tsx b/server/emails/templates/BaseEmail.tsx index fafa5d5305..9841537624 100644 --- a/server/emails/templates/BaseEmail.tsx +++ b/server/emails/templates/BaseEmail.tsx @@ -1,6 +1,7 @@ import addressparser, { EmailAddress } from "addressparser"; import Bull from "bull"; import invariant from "invariant"; +import { subMinutes } from "date-fns"; import { Node } from "prosemirror-model"; import { randomString } from "@shared/random"; import { TeamPreference } from "@shared/types"; @@ -143,12 +144,21 @@ export default abstract class BaseEmail< ? await Notification.emailReferences(notification) : undefined; + // Check if notification is considerably delayed and annotate + // the subject. This is incase of extended downtime or queue backlogs + let subject = this.subject(data); + if (notification) { + if (notification.createdAt < subMinutes(new Date(), 30)) { + subject = `Delayed notification: ${subject}`; + } + } + try { await mailer.sendMail({ to: this.props.to, replyTo: this.replyTo?.(data), from: this.from(data), - subject: this.subject(data), + subject, messageId, references, previewText: this.preview(data),