From 48b7afcdc1d6c3d0702cb90d543bc8d9fb816edf Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 11 Mar 2026 11:16:08 +0100 Subject: [PATCH] Restrict rejection check to ReadAndSign envelopes Previously, rejection logic was applied to all envelopes. Now, the check for rejected receivers and the "EnvelopeRejected" view are only executed if the envelope is of the "ReadAndSign" type, preventing unnecessary rejection handling for other envelope types. --- .../Controllers/EnvelopeController.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/EnvelopeGenerator.Web/Controllers/EnvelopeController.cs b/EnvelopeGenerator.Web/Controllers/EnvelopeController.cs index 11292c49..11f030cf 100644 --- a/EnvelopeGenerator.Web/Controllers/EnvelopeController.cs +++ b/EnvelopeGenerator.Web/Controllers/EnvelopeController.cs @@ -80,12 +80,15 @@ public class EnvelopeController : ViewControllerBase #region Rejected or Signed //check rejection - var rejRcvrs = await _historyService.ReadRejectingReceivers(er.Envelope!.Id); - if (rejRcvrs.Any()) + if (er.Envelope.IsReadAndSign()) { - await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); - ViewBag.IsExt = !rejRcvrs.Contains(er.Receiver); //external if the current user is not rejected - return View("EnvelopeRejected", er); + var rejRcvrs = await _historyService.ReadRejectingReceivers(er.Envelope!.Id); + if (rejRcvrs.Any()) + { + await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); + ViewBag.IsExt = !rejRcvrs.Contains(er.Receiver); //external if the current user is not rejected + return View("EnvelopeRejected", er); + } } //check if it has already signed