Skip to content

Commit

Permalink
Merge pull request #3682 from LibreSign/backport/3670/stable29
Browse files Browse the repository at this point in the history
[stable29] fix: notification parameters need to be string
  • Loading branch information
vitormattos authored Sep 13, 2024
2 parents e0e875e + 2ed41e9 commit f65336f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/Activity/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected function generateNewSignNotificationActivity(
),
'signRequest' => [
'type' => 'sign-request',
'id' => $signRequest->getId(),
'id' => (string)$signRequest->getId(),
'name' => $actor->getDisplayName(),
],
]);
Expand All @@ -126,12 +126,12 @@ protected function generateNewSignNotificationActivity(
}

/**
* @return array{type: 'file', id: int, name: string, path: string, link: string}
* @return array{type: 'file', id: string, name: string, path: string, link: string}
*/
protected function getFileParameter(SignRequest $signRequest, FileEntity $libreSignFile): array {
return [
'type' => 'file',
'id' => $libreSignFile->getNodeId(),
'id' => (string)$libreSignFile->getNodeId(),
'name' => $libreSignFile->getName(),
'path' => $libreSignFile->getName(),
'link' => $this->url->linkToRouteAbsolute('libresign.page.sign', ['uuid' => $signRequest->getUuid()]),
Expand Down
8 changes: 3 additions & 5 deletions lib/Listener/NotificationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private function sendSignNotification(
'file' => $this->getFileParameter($signRequest, $libreSignFile),
'signRequest' => [
'type' => 'sign-request',
'id' => $signRequest->getId(),
'id' => (string)$signRequest->getId(),
'name' => $actor->getDisplayName(),
],
]);
Expand Down Expand Up @@ -122,14 +122,12 @@ public function isNotificationDisabledAtActivity(IIdentifyMethod $identifyMethod
}

/**
* @return (int|string)[]
*
* @psalm-return array{type: 'file', id: int, name: string, path: string, link: string}
* @psalm-return array{type: 'file', id: string, name: string, path: string, link: string}
*/
protected function getFileParameter(SignRequest $signRequest, FileEntity $libreSignFile): array {
return [
'type' => 'file',
'id' => $libreSignFile->getNodeId(),
'id' => (string)$libreSignFile->getNodeId(),
'name' => $libreSignFile->getName(),
'path' => $libreSignFile->getName(),
'link' => $this->url->linkToRouteAbsolute('libresign.page.sign', ['uuid' => $signRequest->getUuid()]),
Expand Down

0 comments on commit f65336f

Please sign in to comment.