Skip to content

Commit af5b9bf

Browse files
committed
fix: preserve insertion order when signingOrder values are equal
When multiple signers have the same signingOrder value, they should maintain their insertion order (defined by signRequestId) rather than being sorted alphabetically by displayName. This change ensures that when signingOrder is equal, signers are sorted by signRequestId (which is auto-incrementing) instead of displayName, preserving the order in which they were originally added. Fixes Behat integration test failures where tests expected signers to appear in insertion order. Signed-off-by: Vitor Mattos <[email protected]>
1 parent 70e7c35 commit af5b9bf

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/Service/FileService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ private function loadLibreSignSigners(): void {
478478
return $orderA <=> $orderB;
479479
}
480480

481-
return strcasecmp($a['displayName'], $b['displayName']);
481+
return ($a['signRequestId'] ?? 0) <=> ($b['signRequestId'] ?? 0);
482482
});
483483

484484
$this->signersLibreSignLoaded = true;
@@ -910,7 +910,7 @@ private function associateAllAndFormat(IUser $user, array $files, array $signers
910910
return $orderA <=> $orderB;
911911
}
912912

913-
return strcasecmp($a['displayName'], $b['displayName']);
913+
return ($a['signRequestId'] ?? 0) <=> ($b['signRequestId'] ?? 0);
914914
});
915915

916916
$files[$key]['statusText'] = $this->fileMapper->getTextOfStatus((int)$files[$key]['status']);

0 commit comments

Comments
 (0)