From 07ad87f65f535aa3e318f9ba3a35bc91d690900c Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 24 Jun 2022 09:57:53 +0200 Subject: [PATCH] fix: Don't send email notification with empty diff --- server/queues/processors/DebounceProcessor.ts | 4 ++-- server/queues/processors/NotificationsProcessor.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/queues/processors/DebounceProcessor.ts b/server/queues/processors/DebounceProcessor.ts index 8759e6e8ff..8720ff18c0 100644 --- a/server/queues/processors/DebounceProcessor.ts +++ b/server/queues/processors/DebounceProcessor.ts @@ -16,8 +16,8 @@ export default class DebounceProcessor extends BaseProcessor { globalEventQueue.add( { ...event, name: "documents.update.delayed" }, { - // Revision creation time is lowered to one minute in development - delay: (env.ENVIRONMENT === "production" ? 5 : 1) * 60 * 1000, + // Revision creation time is lowered to half a minute in development + delay: (env.ENVIRONMENT === "production" ? 5 : 0.5) * 60 * 1000, } ); break; diff --git a/server/queues/processors/NotificationsProcessor.ts b/server/queues/processors/NotificationsProcessor.ts index a4d1cb71c6..79a5d057f3 100644 --- a/server/queues/processors/NotificationsProcessor.ts +++ b/server/queues/processors/NotificationsProcessor.ts @@ -219,6 +219,10 @@ export default class NotificationsProcessor extends BaseProcessor { }); let content = markdownDiff(previous ? previous.text : "", revision.text); + if (!content) { + continue; + } + content = await replaceImageAttachments(content); await DocumentNotificationEmail.schedule({