From 44397befdc7611b70971ed723ee6ef0ecabb72d4 Mon Sep 17 00:00:00 2001 From: samuelsonmesquita Date: Mon, 29 Dec 2025 21:42:29 -0400 Subject: [PATCH 1/9] feat: add dashboard pending signatures widget Signed-off-by: samuelsonmesquita --- lib/AppInfo/Application.php | 4 + lib/Dashboard/PendingSignaturesWidget.php | 225 ++++++++++++++++++++++ 2 files changed, 229 insertions(+) create mode 100644 lib/Dashboard/PendingSignaturesWidget.php diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 7b813e0e03..0be5b1313c 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -12,6 +12,7 @@ use OCA\Files\Event\LoadSidebar; use OCA\Libresign\Activity\Listener as ActivityListener; use OCA\Libresign\Capabilities; +use OCA\Libresign\Dashboard\PendingSignaturesWidget; use OCA\Libresign\Events\SendSignNotificationEvent; use OCA\Libresign\Events\SignedEvent; use OCA\Libresign\Events\SignRequestCanceledEvent; @@ -89,5 +90,8 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(SignedEvent::class, TwofactorGatewayListener::class); $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); + + // Register Dashboard Widget + $context->registerDashboardWidget(PendingSignaturesWidget::class); } } diff --git a/lib/Dashboard/PendingSignaturesWidget.php b/lib/Dashboard/PendingSignaturesWidget.php new file mode 100644 index 0000000000..a757319c49 --- /dev/null +++ b/lib/Dashboard/PendingSignaturesWidget.php @@ -0,0 +1,225 @@ +l10n->t('Pending signatures'); + } + + /** + * @inheritDoc + */ + public function getOrder(): int { + return 10; + } + + /** + * @inheritDoc + */ + public function getIconClass(): string { + return 'icon-libresign-dark'; + } + + /** + * @inheritDoc + */ + public function getUrl(): ?string { + return $this->urlGenerator->linkToRouteAbsolute('libresign.page.index'); + } + + /** + * @inheritDoc + */ + public function load(): void { + //Util::addScript('libresign', 'libresign-dashboard'); + } + + /** + * @inheritDoc + */ + public function getItemsV2(string $userId, ?string $since = null, int $limit = 7): WidgetItems { + try { + $user = $this->userSession->getUser(); + if (!$user) { + return new WidgetItems([], $this->l10n->t('User not found')); + } + + $result = $this->signRequestMapper->getFilesAssociatedFilesWithMe( + $user, + ['status' => [\OCA\Libresign\Db\File::STATUS_ABLE_TO_SIGN, \OCA\Libresign\Db\File::STATUS_PARTIAL_SIGNED]], + 1, + $limit, + ['sortBy' => 'created_at', 'sortDirection' => 'desc'] + ); + + $items = []; + + foreach ($result['data'] as $fileEntity) { + try { + $signRequest = $this->getSignRequestForUser($fileEntity, $user); + + if (!$signRequest || $signRequest->getSigned()) { + continue; + } + + $item = new WidgetItem( + $this->getDocumentTitle($fileEntity), + $this->getSubtitle($signRequest, $fileEntity), + $this->urlGenerator->linkToRouteAbsolute('libresign.page.sign', ['uuid' => $signRequest->getUuid()]), + $this->urlGenerator->getAbsoluteURL( + $this->urlGenerator->imagePath('libresign', 'app-dark.svg') + ), + $this->getTimestamp($fileEntity) + ); + + $items[] = $item; + } catch (\Exception $e) { + continue; + } + } + + return new WidgetItems( + $items, + empty($items) ? $this->l10n->t('No pending signatures') : '', + ); + } catch (\Exception $e) { + return new WidgetItems( + [], + $this->l10n->t('Error loading pending signatures'), + ); + } + } + + private function getSignRequestForUser(\OCA\Libresign\Db\File $fileEntity, \OCP\IUser $user): ?\OCA\Libresign\Db\SignRequest { + try { + $signRequests = $this->signRequestMapper->getByFileId($fileEntity->getId()); + + foreach ($signRequests as $signRequest) { + if ($this->signRequestBelongsToUser($signRequest, $user)) { + return $signRequest; + } + } + } catch (\Exception $e) { + return null; + } + + return null; + } + + private function signRequestBelongsToUser(\OCA\Libresign\Db\SignRequest $signRequest, \OCP\IUser $user): bool { + try { + $validSignRequest = $this->signFileService->getSignRequestToSign( + $this->signFileService->getFile($signRequest->getFileId()), + $signRequest->getUuid(), + $user + ); + + return $validSignRequest->getId() === $signRequest->getId(); + } catch (\Exception $e) { + return false; + } + } + + private function getDocumentTitle(\OCA\Libresign\Db\File $fileEntity): string { + if ($fileEntity->getName()) { + return $fileEntity->getName(); + } + + try { + $files = $this->signFileService->getNextcloudFiles($fileEntity); + if (!empty($files)) { + $file = current($files); + return $file->getName(); + } + } catch (\Exception $e) { + } + + return $this->l10n->t('Document'); + } + + private function getSubtitle(\OCA\Libresign\Db\SignRequest $signRequest, \OCA\Libresign\Db\File $fileEntity): string { + $parts = []; + + $displayName = $signRequest->getDisplayName(); + if ($displayName) { + $parts[] = $this->l10n->t('From: %s', [$displayName]); + } + + $createdAt = $fileEntity->getCreatedAt(); + if ($createdAt instanceof \DateTime) { + $date = $createdAt->format('d/m/Y'); + $parts[] = $this->l10n->t('Date: %s', [$date]); + } + + return implode(' • ', $parts); + } + + private function getTimestamp(\OCA\Libresign\Db\File $fileEntity): string { + $createdAt = $fileEntity->getCreatedAt(); + if ($createdAt instanceof \DateTime) { + return (string)$createdAt->getTimestamp(); + } + return ''; + } + + /** + * @inheritDoc + * @deprecated Use getItemsV2 instead + */ + public function getItems(string $userId, ?string $since = null, int $limit = 7): array { + $widgetItems = $this->getItemsV2($userId, $since, $limit); + return $widgetItems->getItems(); + } + + /** + * @inheritDoc + */ + public function getWidgetButtons(string $userId): array { + return [ + new WidgetButton( + WidgetButton::TYPE_MORE, + $this->urlGenerator->linkToRouteAbsolute('libresign.page.index'), + $this->l10n->t('View all documents') + ), + ]; + } +} From 25977facef277c46970f7946f2beac6e6053c1b3 Mon Sep 17 00:00:00 2001 From: samuelsonmesquita Date: Wed, 31 Dec 2025 10:53:23 -0400 Subject: [PATCH 2/9] chore: ajustment url Signed-off-by: samuelsonmesquita --- lib/Dashboard/PendingSignaturesWidget.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/Dashboard/PendingSignaturesWidget.php b/lib/Dashboard/PendingSignaturesWidget.php index a757319c49..5bda8d2afb 100644 --- a/lib/Dashboard/PendingSignaturesWidget.php +++ b/lib/Dashboard/PendingSignaturesWidget.php @@ -11,6 +11,8 @@ use OCA\Libresign\Db\SignRequestMapper; use OCA\Libresign\Service\SignFileService; +use OCA\UserStatus\AppInfo\Application; +use OCP\Dashboard\IAPIWidget; use OCP\Dashboard\IAPIWidgetV2; use OCP\Dashboard\IButtonWidget; use OCP\Dashboard\Model\WidgetButton; @@ -21,7 +23,7 @@ use OCP\IUserSession; use OCP\Util; -class PendingSignaturesWidget implements IAPIWidgetV2, IButtonWidget { +class PendingSignaturesWidget implements IAPIWidget, IAPIWidgetV2, IButtonWidget { public function __construct( private IL10N $l10n, private IURLGenerator $urlGenerator, @@ -56,7 +58,16 @@ public function getOrder(): int { * @inheritDoc */ public function getIconClass(): string { - return 'icon-libresign-dark'; + return 'icon-libresign'; + } + + /** + * @inheritDoc + */ + public function getIconUrl(): string { + return $this->urlGenerator->getAbsoluteURL( + $this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg') + ); } /** @@ -104,7 +115,7 @@ public function getItemsV2(string $userId, ?string $since = null, int $limit = 7 $item = new WidgetItem( $this->getDocumentTitle($fileEntity), $this->getSubtitle($signRequest, $fileEntity), - $this->urlGenerator->linkToRouteAbsolute('libresign.page.sign', ['uuid' => $signRequest->getUuid()]), + $this->urlGenerator->linkToRouteAbsolute('libresign.page.signFPath', ['uuid' => $signRequest->getUuid(), 'path' => 'pdf']), $this->urlGenerator->getAbsoluteURL( $this->urlGenerator->imagePath('libresign', 'app-dark.svg') ), From 19e71b3cd5d8f5a4e50cb64437167fba67fa2020 Mon Sep 17 00:00:00 2001 From: samuelsonmesquita Date: Wed, 31 Dec 2025 16:09:58 -0400 Subject: [PATCH 3/9] chore: add icon libresign and pdf Signed-off-by: samuelsonmesquita --- lib/Dashboard/PendingSignaturesWidget.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Dashboard/PendingSignaturesWidget.php b/lib/Dashboard/PendingSignaturesWidget.php index 5bda8d2afb..83ad2fffe8 100644 --- a/lib/Dashboard/PendingSignaturesWidget.php +++ b/lib/Dashboard/PendingSignaturesWidget.php @@ -11,10 +11,11 @@ use OCA\Libresign\Db\SignRequestMapper; use OCA\Libresign\Service\SignFileService; -use OCA\UserStatus\AppInfo\Application; +use OCA\Libresign\AppInfo\Application; use OCP\Dashboard\IAPIWidget; use OCP\Dashboard\IAPIWidgetV2; use OCP\Dashboard\IButtonWidget; +use OCP\Dashboard\IIconWidget; use OCP\Dashboard\Model\WidgetButton; use OCP\Dashboard\Model\WidgetItem; use OCP\Dashboard\Model\WidgetItems; @@ -23,7 +24,7 @@ use OCP\IUserSession; use OCP\Util; -class PendingSignaturesWidget implements IAPIWidget, IAPIWidgetV2, IButtonWidget { +class PendingSignaturesWidget implements IAPIWidget, IAPIWidgetV2, IButtonWidget, IIconWidget { public function __construct( private IL10N $l10n, private IURLGenerator $urlGenerator, @@ -81,7 +82,7 @@ public function getUrl(): ?string { * @inheritDoc */ public function load(): void { - //Util::addScript('libresign', 'libresign-dashboard'); + } /** @@ -117,7 +118,7 @@ public function getItemsV2(string $userId, ?string $since = null, int $limit = 7 $this->getSubtitle($signRequest, $fileEntity), $this->urlGenerator->linkToRouteAbsolute('libresign.page.signFPath', ['uuid' => $signRequest->getUuid(), 'path' => 'pdf']), $this->urlGenerator->getAbsoluteURL( - $this->urlGenerator->imagePath('libresign', 'app-dark.svg') + $this->urlGenerator->imagePath('core', 'filetypes/application-pdf.svg') ), $this->getTimestamp($fileEntity) ); From fb2df589489d3e39d77c949ebd34ea27b92cf7e0 Mon Sep 17 00:00:00 2001 From: samuelsonmesquita Date: Wed, 31 Dec 2025 16:19:39 -0400 Subject: [PATCH 4/9] fix: psalm Signed-off-by: samuelsonmesquita --- lib/Dashboard/PendingSignaturesWidget.php | 47 +++++++---------------- tests/psalm-baseline.xml | 8 ++++ 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/lib/Dashboard/PendingSignaturesWidget.php b/lib/Dashboard/PendingSignaturesWidget.php index 83ad2fffe8..cb5799bd94 100644 --- a/lib/Dashboard/PendingSignaturesWidget.php +++ b/lib/Dashboard/PendingSignaturesWidget.php @@ -9,9 +9,9 @@ namespace OCA\Libresign\Dashboard; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Db\SignRequestMapper; use OCA\Libresign\Service\SignFileService; -use OCA\Libresign\AppInfo\Application; use OCP\Dashboard\IAPIWidget; use OCP\Dashboard\IAPIWidgetV2; use OCP\Dashboard\IButtonWidget; @@ -22,7 +22,7 @@ use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUserSession; -use OCP\Util; +use Override; class PendingSignaturesWidget implements IAPIWidget, IAPIWidgetV2, IButtonWidget, IIconWidget { public function __construct( @@ -34,60 +34,44 @@ public function __construct( ) { } - /** - * @inheritDoc - */ + #[Override] public function getId(): string { return 'libresign_pending_signatures'; } - /** - * @inheritDoc - */ + #[Override] public function getTitle(): string { return $this->l10n->t('Pending signatures'); } - /** - * @inheritDoc - */ + #[Override] public function getOrder(): int { return 10; } - /** - * @inheritDoc - */ + #[Override] public function getIconClass(): string { return 'icon-libresign'; } - /** - * @inheritDoc - */ + #[Override] public function getIconUrl(): string { return $this->urlGenerator->getAbsoluteURL( $this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg') ); } - /** - * @inheritDoc - */ + #[Override] public function getUrl(): ?string { return $this->urlGenerator->linkToRouteAbsolute('libresign.page.index'); } - /** - * @inheritDoc - */ + #[Override] public function load(): void { - + // No special loading required } - /** - * @inheritDoc - */ + #[Override] public function getItemsV2(string $userId, ?string $since = null, int $limit = 7): WidgetItems { try { $user = $this->userSession->getUser(); @@ -213,18 +197,13 @@ private function getTimestamp(\OCA\Libresign\Db\File $fileEntity): string { return ''; } - /** - * @inheritDoc - * @deprecated Use getItemsV2 instead - */ + #[Override] public function getItems(string $userId, ?string $since = null, int $limit = 7): array { $widgetItems = $this->getItemsV2($userId, $since, $limit); return $widgetItems->getItems(); } - /** - * @inheritDoc - */ + #[Override] public function getWidgetButtons(string $userId): array { return [ new WidgetButton( diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index 7876bec980..a4bbcf940c 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -46,6 +46,14 @@ + + + getItems()]]> + + + + + From e28fadb77796fe74f84291569e93601f82ffaa43 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 3 Feb 2026 21:16:35 -0300 Subject: [PATCH 5/9] feat: add IConditionalWidget to PendingSignaturesWidget - Implement IConditionalWidget interface to conditionally display widget - Add isEnabled() method that checks if LibreSign certificate engine is configured - Widget will only display on dashboard when LibreSign setup is complete - Inject CertificateEngineFactory to verify installation status - Prevents showing widget when LibreSign is not properly configured Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/Dashboard/PendingSignaturesWidget.php | 142 +++++++--------------- 1 file changed, 46 insertions(+), 96 deletions(-) diff --git a/lib/Dashboard/PendingSignaturesWidget.php b/lib/Dashboard/PendingSignaturesWidget.php index cb5799bd94..c8fa739dc2 100644 --- a/lib/Dashboard/PendingSignaturesWidget.php +++ b/lib/Dashboard/PendingSignaturesWidget.php @@ -11,10 +11,12 @@ use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Db\SignRequestMapper; -use OCA\Libresign\Service\SignFileService; +use OCA\Libresign\Enum\FileStatus; +use OCA\Libresign\Handler\CertificateEngine\CertificateEngineFactory; use OCP\Dashboard\IAPIWidget; use OCP\Dashboard\IAPIWidgetV2; use OCP\Dashboard\IButtonWidget; +use OCP\Dashboard\IConditionalWidget; use OCP\Dashboard\IIconWidget; use OCP\Dashboard\Model\WidgetButton; use OCP\Dashboard\Model\WidgetItem; @@ -24,13 +26,13 @@ use OCP\IUserSession; use Override; -class PendingSignaturesWidget implements IAPIWidget, IAPIWidgetV2, IButtonWidget, IIconWidget { +class PendingSignaturesWidget implements IAPIWidget, IAPIWidgetV2, IButtonWidget, IConditionalWidget, IIconWidget { public function __construct( private IL10N $l10n, private IURLGenerator $urlGenerator, - private SignFileService $signFileService, private SignRequestMapper $signRequestMapper, private IUserSession $userSession, + private CertificateEngineFactory $certificateEngineFactory, ) { } @@ -71,122 +73,70 @@ public function load(): void { // No special loading required } + #[Override] + public function isEnabled(): bool { + return $this->certificateEngineFactory->getEngine()->isSetupOk(); + } + #[Override] public function getItemsV2(string $userId, ?string $since = null, int $limit = 7): WidgetItems { - try { - $user = $this->userSession->getUser(); - if (!$user) { - return new WidgetItems([], $this->l10n->t('User not found')); - } + $user = $this->userSession->getUser(); + if (!$user) { + return new WidgetItems([], $this->l10n->t('User not found')); + } - $result = $this->signRequestMapper->getFilesAssociatedFilesWithMe( - $user, - ['status' => [\OCA\Libresign\Db\File::STATUS_ABLE_TO_SIGN, \OCA\Libresign\Db\File::STATUS_PARTIAL_SIGNED]], - 1, - $limit, - ['sortBy' => 'created_at', 'sortDirection' => 'desc'] - ); - - $items = []; - - foreach ($result['data'] as $fileEntity) { - try { - $signRequest = $this->getSignRequestForUser($fileEntity, $user); - - if (!$signRequest || $signRequest->getSigned()) { - continue; - } - - $item = new WidgetItem( - $this->getDocumentTitle($fileEntity), - $this->getSubtitle($signRequest, $fileEntity), - $this->urlGenerator->linkToRouteAbsolute('libresign.page.signFPath', ['uuid' => $signRequest->getUuid(), 'path' => 'pdf']), - $this->urlGenerator->getAbsoluteURL( - $this->urlGenerator->imagePath('core', 'filetypes/application-pdf.svg') - ), - $this->getTimestamp($fileEntity) - ); - - $items[] = $item; - } catch (\Exception $e) { - continue; - } - } + $result = $this->signRequestMapper->getFilesAssociatedFilesWithMe( + $user, + ['status' => [FileStatus::ABLE_TO_SIGN->value, FileStatus::PARTIAL_SIGNED->value]], + 1, + $limit, + ['sortBy' => 'created_at', 'sortDirection' => 'desc'] + ); - return new WidgetItems( - $items, - empty($items) ? $this->l10n->t('No pending signatures') : '', - ); - } catch (\Exception $e) { - return new WidgetItems( - [], - $this->l10n->t('Error loading pending signatures'), - ); - } - } + $items = []; - private function getSignRequestForUser(\OCA\Libresign\Db\File $fileEntity, \OCP\IUser $user): ?\OCA\Libresign\Db\SignRequest { - try { + foreach ($result['data'] as $fileEntity) { $signRequests = $this->signRequestMapper->getByFileId($fileEntity->getId()); foreach ($signRequests as $signRequest) { - if ($this->signRequestBelongsToUser($signRequest, $user)) { - return $signRequest; + if ($signRequest->getSigned()) { + continue; } + + $item = new WidgetItem( + $this->getDocumentTitle($fileEntity), + $this->getSubtitle($signRequest, $fileEntity), + $this->urlGenerator->linkToRouteAbsolute('libresign.page.signFPath', ['uuid' => $signRequest->getUuid(), 'path' => 'pdf']), + $this->urlGenerator->getAbsoluteURL( + $this->urlGenerator->imagePath('core', 'filetypes/application-pdf.svg') + ), + $this->getTimestamp($fileEntity) + ); + + $items[] = $item; } - } catch (\Exception $e) { - return null; } - return null; - } - - private function signRequestBelongsToUser(\OCA\Libresign\Db\SignRequest $signRequest, \OCP\IUser $user): bool { - try { - $validSignRequest = $this->signFileService->getSignRequestToSign( - $this->signFileService->getFile($signRequest->getFileId()), - $signRequest->getUuid(), - $user - ); - - return $validSignRequest->getId() === $signRequest->getId(); - } catch (\Exception $e) { - return false; - } + return new WidgetItems( + $items, + empty($items) ? $this->l10n->t('No pending signatures') : '', + ); } private function getDocumentTitle(\OCA\Libresign\Db\File $fileEntity): string { - if ($fileEntity->getName()) { - return $fileEntity->getName(); - } - - try { - $files = $this->signFileService->getNextcloudFiles($fileEntity); - if (!empty($files)) { - $file = current($files); - return $file->getName(); - } - } catch (\Exception $e) { - } - - return $this->l10n->t('Document'); + return $fileEntity->getName(); } private function getSubtitle(\OCA\Libresign\Db\SignRequest $signRequest, \OCA\Libresign\Db\File $fileEntity): string { - $parts = []; - $displayName = $signRequest->getDisplayName(); - if ($displayName) { - $parts[] = $this->l10n->t('From: %s', [$displayName]); - } - $createdAt = $fileEntity->getCreatedAt(); if ($createdAt instanceof \DateTime) { $date = $createdAt->format('d/m/Y'); - $parts[] = $this->l10n->t('Date: %s', [$date]); + // TRANSLATORS %s is the sender name, %s is the date + return $this->l10n->t('From: %s • Date: %s', [$displayName, $date]); } - - return implode(' • ', $parts); + // TRANSLATORS %s is the sender name + return $this->l10n->t('From: %s', [$displayName]); } private function getTimestamp(\OCA\Libresign\Db\File $fileEntity): string { From c22e064f8f29b6026b3406f8089f3f88ff9be070 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 3 Feb 2026 21:34:55 -0300 Subject: [PATCH 6/9] chore: remove unecessary comment Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/AppInfo/Application.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 0be5b1313c..15ac1de26c 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -91,7 +91,6 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); - // Register Dashboard Widget $context->registerDashboardWidget(PendingSignaturesWidget::class); } } From f6a7dee8d33a9428637c9a8693b777797ebefb3b Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 3 Feb 2026 21:36:00 -0300 Subject: [PATCH 7/9] chore: simplify code, remove unecessary method Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/Dashboard/PendingSignaturesWidget.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/Dashboard/PendingSignaturesWidget.php b/lib/Dashboard/PendingSignaturesWidget.php index c8fa739dc2..b5f09b2c67 100644 --- a/lib/Dashboard/PendingSignaturesWidget.php +++ b/lib/Dashboard/PendingSignaturesWidget.php @@ -104,7 +104,7 @@ public function getItemsV2(string $userId, ?string $since = null, int $limit = 7 } $item = new WidgetItem( - $this->getDocumentTitle($fileEntity), + $fileEntity->getName(), $this->getSubtitle($signRequest, $fileEntity), $this->urlGenerator->linkToRouteAbsolute('libresign.page.signFPath', ['uuid' => $signRequest->getUuid(), 'path' => 'pdf']), $this->urlGenerator->getAbsoluteURL( @@ -123,10 +123,6 @@ public function getItemsV2(string $userId, ?string $since = null, int $limit = 7 ); } - private function getDocumentTitle(\OCA\Libresign\Db\File $fileEntity): string { - return $fileEntity->getName(); - } - private function getSubtitle(\OCA\Libresign\Db\SignRequest $signRequest, \OCA\Libresign\Db\File $fileEntity): string { $displayName = $signRequest->getDisplayName(); $createdAt = $fileEntity->getCreatedAt(); From 02ca2715c9807402856da5c36b5425789554f493 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 3 Feb 2026 21:37:06 -0300 Subject: [PATCH 8/9] refactor: inclue class by use Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/Dashboard/PendingSignaturesWidget.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Dashboard/PendingSignaturesWidget.php b/lib/Dashboard/PendingSignaturesWidget.php index b5f09b2c67..38eabb0b89 100644 --- a/lib/Dashboard/PendingSignaturesWidget.php +++ b/lib/Dashboard/PendingSignaturesWidget.php @@ -10,6 +10,8 @@ namespace OCA\Libresign\Dashboard; use OCA\Libresign\AppInfo\Application; +use OCA\Libresign\Db\File; +use OCA\Libresign\Db\SignRequest; use OCA\Libresign\Db\SignRequestMapper; use OCA\Libresign\Enum\FileStatus; use OCA\Libresign\Handler\CertificateEngine\CertificateEngineFactory; @@ -123,7 +125,7 @@ public function getItemsV2(string $userId, ?string $since = null, int $limit = 7 ); } - private function getSubtitle(\OCA\Libresign\Db\SignRequest $signRequest, \OCA\Libresign\Db\File $fileEntity): string { + private function getSubtitle(SignRequest $signRequest, File $fileEntity): string { $displayName = $signRequest->getDisplayName(); $createdAt = $fileEntity->getCreatedAt(); if ($createdAt instanceof \DateTime) { @@ -135,7 +137,7 @@ private function getSubtitle(\OCA\Libresign\Db\SignRequest $signRequest, \OCA\Li return $this->l10n->t('From: %s', [$displayName]); } - private function getTimestamp(\OCA\Libresign\Db\File $fileEntity): string { + private function getTimestamp(File $fileEntity): string { $createdAt = $fileEntity->getCreatedAt(); if ($createdAt instanceof \DateTime) { return (string)$createdAt->getTimestamp(); From e4fc1191ba853ad3f1146b975260bc7949dfe026 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 3 Feb 2026 21:41:00 -0300 Subject: [PATCH 9/9] fix: psalm issues Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- lib/Dashboard/PendingSignaturesWidget.php | 2 +- tests/psalm-baseline.xml | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/Dashboard/PendingSignaturesWidget.php b/lib/Dashboard/PendingSignaturesWidget.php index 38eabb0b89..f288a867d0 100644 --- a/lib/Dashboard/PendingSignaturesWidget.php +++ b/lib/Dashboard/PendingSignaturesWidget.php @@ -148,7 +148,7 @@ private function getTimestamp(File $fileEntity): string { #[Override] public function getItems(string $userId, ?string $since = null, int $limit = 7): array { $widgetItems = $this->getItemsV2($userId, $since, $limit); - return $widgetItems->getItems(); + return array_values($widgetItems->getItems()); } #[Override] diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index a4bbcf940c..7876bec980 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -46,14 +46,6 @@ - - - getItems()]]> - - - - -