Skip to content

Commit

Permalink
fix: notification parameters need to be string
Browse files Browse the repository at this point in the history
All values of a notification need to be a string

Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Sep 13, 2024
1 parent 4e8fe31 commit d61c79d
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 @@ -98,7 +98,7 @@ protected function generateNewSignNotificationActivity(
),
'signRequest' => [
'type' => 'sign-request',
'id' => $signRequest->getId(),
'id' => (string)$signRequest->getId(),
'name' => $actor->getDisplayName(),
],
]);
Expand All @@ -110,12 +110,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 @@ -77,7 +77,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 @@ -106,14 +106,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 d61c79d

Please sign in to comment.