Skip to content

Commit 36ecd1e

Browse files
fix: respect status 0 (DRAFT) when adding new signers
When adding a new signer with status 0, the backend was ignoring it because empty() treated 0 as falsy. Changed to isset() to properly handle status 0. Also updated determineInitialStatus() to allow new signers to be added in DRAFT mode even when the file is not in DRAFT status, allowing gradual signer addition before requesting signatures. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent a9f3982 commit 36ecd1e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/Service/RequestSignatureService.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(
5353
public function save(array $data): FileEntity {
5454
$file = $this->saveFile($data);
5555
$this->saveVisibleElements($data, $file);
56-
if (empty($data['status'])) {
56+
if (!isset($data['status'])) {
5757
$data['status'] = $file->getStatus();
5858
}
5959
$this->associateToSigners($data, $file->getId());
@@ -289,6 +289,8 @@ private function associateToSigner(
289289
}
290290

291291
private function determineInitialStatus(int $signingOrder, ?int $fileStatus = null): \OCA\Libresign\Enum\SignRequestStatus {
292+
// If fileStatus is explicitly DRAFT (0), keep signer as DRAFT
293+
// This allows adding new signers in DRAFT mode even when file is not in DRAFT status
292294
if ($fileStatus === FileEntity::STATUS_DRAFT) {
293295
return \OCA\Libresign\Enum\SignRequestStatus::DRAFT;
294296
}

0 commit comments

Comments
 (0)