From 8b7f99eb76bd14fe4796a18e312e85d607abbed1 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 28 Oct 2026 13:15:20 +0100 Subject: [PATCH] Prevent email on deleted envelopes; bump version Added a check in SendMailHandler to prevent sending emails for deleted envelopes with a status of EnvelopeSaved or lower. Updated project version in EnvelopeGenerator.Server.csproj from 1.7.0 to 1.8.0 to reflect these changes. --- .../Common/Notifications/SendMailHandler.cs | 5 +++++ .../EnvelopeGenerator.Server.csproj | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs b/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs index 50cf3662..85c0ca0c 100644 --- a/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs +++ b/EnvelopeGenerator.Application/Common/Notifications/SendMailHandler.cs @@ -2,6 +2,7 @@ using DigitalData.EmailProfilerDispatcher.Abstraction.Entities; using EnvelopeGenerator.Application.Common.Configurations; using EnvelopeGenerator.Application.Common.Extensions; +using EnvelopeGenerator.Application.Common.Notifications.EnvelopeDeleted; using EnvelopeGenerator.Domain.Constants; using EnvelopeGenerator.Domain.Entities; using MediatR; @@ -96,6 +97,10 @@ public abstract class SendMailHandler : INotificationHandler public virtual async Task Handle(TNotification notification, CancellationToken cancel) { + // do not send email if the envelope is deleted and the status is less than or equal to EnvelopeSaved + if (notification is EnvelopeDeletedNotification delNot && delNot.Envelope.Status <= EnvelopeStatus.EnvelopeSaved) + return; + var placeHolders = CreatePlaceHolders(notification); var temp = await TempRepo diff --git a/EnvelopeGenerator.Server/EnvelopeGenerator.Server/EnvelopeGenerator.Server.csproj b/EnvelopeGenerator.Server/EnvelopeGenerator.Server/EnvelopeGenerator.Server.csproj index 0bf615a9..5fd58752 100644 --- a/EnvelopeGenerator.Server/EnvelopeGenerator.Server/EnvelopeGenerator.Server.csproj +++ b/EnvelopeGenerator.Server/EnvelopeGenerator.Server/EnvelopeGenerator.Server.csproj @@ -10,9 +10,9 @@ Digital Data GmbH Digital Data GmbH EnvelopeGenerator.Server - 1.7.0-beta - 1.7.0.0 - 1.7.0.0 + 1.8.0-beta + 1.8.0.0 + 1.8.0.0 Copyright © 2026 Digital Data GmbH. All rights reserved. bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml