Skip to content

Commit c86cb4a

Browse files
committed
fix: only notify signers with ABLE_TO_SIGN status in sequential flow
In ordered_numeric signature flow, all signers were receiving notifications regardless of their status. This caused signers with signing_order > 1 (status DRAFT) to be notified immediately. Changes: - Update SignRequest status on PATCH operations, not just INSERT - Only notify signers when status is ABLE_TO_SIGN - Ensure signers with order > 1 remain in DRAFT status until previous orders are completed This ensures notifications are sent only to signers who can actually sign at that moment. Signed-off-by: Vitor Mattos <[email protected]>
1 parent 9688265 commit c86cb4a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/Service/RequestSignatureService.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,21 @@ private function associateToSigner(
264264

265265
$signRequest->setSigningOrder($signingOrder);
266266

267-
if (!$signRequest->getId()) {
267+
$isNewSignRequest = !$signRequest->getId();
268+
$currentStatus = $signRequest->getStatusEnum();
269+
270+
if ($isNewSignRequest || $currentStatus === \OCA\Libresign\Db\SignRequestStatus::DRAFT) {
268271
$initialStatus = $this->determineInitialStatus($signingOrder);
269272
$signRequest->setStatusEnum($initialStatus);
270273
}
271274

272275
$this->saveSignRequest($signRequest);
276+
277+
$shouldNotify = $notify && $signRequest->getStatusEnum() === \OCA\Libresign\Db\SignRequestStatus::ABLE_TO_SIGN;
278+
273279
foreach ($identifyMethodsIncances as $identifyMethod) {
274280
$identifyMethod->getEntity()->setSignRequestId($signRequest->getId());
275-
$identifyMethod->willNotifyUser($notify);
281+
$identifyMethod->willNotifyUser($shouldNotify);
276282
$identifyMethod->save();
277283
}
278284
return $signRequest;

0 commit comments

Comments
 (0)