Commit graph

10,548 commits

Author SHA1 Message Date
Vitor Mattos
ff3a16f223
feat: add status and statusText to ID docs signer data
Include status and statusText fields when formatting signers in
ID documents responses. This ensures consistency across all API
endpoints that return signer information.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 14:34:45 -03:00
Vitor Mattos
8af983763d
feat: include status and statusText in signer responses
Add status and statusText fields to all signer data returned by
FileService. This includes:
- Signers from LibreSign metadata (loadLibreSignSigners)
- Signers from PDF certificate data (loadSignersFromCertData)
- Signers in file listings (associateAllAndFormat)

The status field contains the numeric code (0=Draft, 1=Pending, 2=Signed)
and statusText contains the localized label.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 14:34:36 -03:00
Vitor Mattos
8602edfb4e
feat: add status and statusText to LibresignSigner type
Update the LibresignSigner psalm type definition to include status
and statusText as required fields (not optional). These fields will
always be present in API responses for signer data.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 14:34:26 -03:00
Vitor Mattos
c5c2ee1c95
feat: add getTextOfSignerStatus method to SignRequestMapper
Add a helper method to get localized status text for signers using
the SignRequestStatus enum. This method delegates to the enum's
getLabel() method to maintain consistency across the application.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 14:34:13 -03:00
Vitor Mattos
e3ad25951a
feat: add getLabel method to SignRequestStatus enum
Add a getLabel() method to the SignRequestStatus enum to provide
localized status labels (Draft, Pending, Signed). This follows the
same pattern as DocMdpLevel enum and centralizes the translation
logic in the enum itself rather than spreading it across multiple
files.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 14:28:17 -03:00
Vitor Mattos
453b200bcf
Merge pull request #6108 from LibreSign/feat/auto-save-signer-on-add
feat: auto-save signer with status 0 when added
2025-12-11 14:11:58 -03:00
Vitor Mattos
66d95e7dcc
feat: auto-save signer with status 0 when added
Automatically saves the signer to the server with status 0 (draft)
when the user adds a new signer through the Add Signer dialog.
This eliminates the need for a separate manual save action after
adding each signer.

The PATCH request is sent to /apps/libresign/api/v1/request-signature
with status: 0 immediately after the signer is added to the local state.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 13:27:01 -03:00
Vitor Mattos
efacc43884
Merge pull request #6107 from LibreSign/dependabot/composer/vendor-bin/psalm/vimeo/psalm-6.14.2
chore(deps-dev): Bump vimeo/psalm from 6.14.1 to 6.14.2 in /vendor-bin/psalm
2025-12-11 13:24:20 -03:00
Vitor Mattos
9bcb9b6b75
Merge pull request #6106 from LibreSign/dependabot/composer/tests/integration/behat/behat-3.29.0
chore(deps): Bump behat/behat from 3.27.0 to 3.29.0 in /tests/integration
2025-12-11 13:23:56 -03:00
dependabot[bot]
31e26ebe07
chore(deps-dev): Bump vimeo/psalm in /vendor-bin/psalm
Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 6.14.1 to 6.14.2.
- [Release notes](https://github.com/vimeo/psalm/releases)
- [Commits](https://github.com/vimeo/psalm/compare/6.14.1...6.14.2)

---
updated-dependencies:
- dependency-name: vimeo/psalm
  dependency-version: 6.14.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-11 16:15:33 +00:00
dependabot[bot]
6546a901e6
chore(deps): Bump behat/behat in /tests/integration
Bumps [behat/behat](https://github.com/Behat/Behat) from 3.27.0 to 3.29.0.
- [Release notes](https://github.com/Behat/Behat/releases)
- [Changelog](https://github.com/Behat/Behat/blob/3.x/CHANGELOG.md)
- [Commits](https://github.com/Behat/Behat/compare/v3.27.0...v3.29.0)

---
updated-dependencies:
- dependency-name: behat/behat
  dependency-version: 3.29.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-11 16:13:27 +00:00
Vitor Mattos
24cc223fcc
Merge pull request #6103 from LibreSign/fix/respect-draft-status-in-sign-requests
fix: respect draft status in sign requests
2025-12-11 12:58:18 -03:00
Vitor Mattos
25bce290e4
feat: respect draft status when creating sign requests
When file status is draft, new sign requests should also start as
draft regardless of signing order. This prevents automatic
notifications and keeps requests in draft mode until file is ready.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 12:48:41 -03:00
Vitor Mattos
45554e7ecf
feat: add status field to signer data in file info
Include signer status in the signers array returned by file info
endpoint to allow frontend to display draft/pending status.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 12:48:32 -03:00
Vitor Mattos
1d9729216f
Merge pull request #6100 from LibreSign/refactor/organize-enums-in-dedicated-folder
refactor: organize enums in dedicated folder
2025-12-11 11:54:55 -03:00
Vitor Mattos
3a55587934
refactor: move SignatureFlow enum to dedicated Enum directory
Move SignatureFlow from lib/Service/ to lib/Enum/ to centralize all
enum definitions in the same location following project structure
conventions.

Updated namespace from OCA\Libresign\Service to OCA\Libresign\Enum
and adjusted all imports and references across:
- AdminController (updated FQN references for from() and comparison)
- PageController (updated FQN reference)
- TemplateLoader (updated FQN reference)
- Settings/Admin (updated import statement)
- SequentialSigningService (added explicit import)

This completes the consolidation of enum types, making the codebase
more organized and easier to maintain.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 11:45:53 -03:00
Vitor Mattos
552521e546
refactor: move SignRequestStatus enum to dedicated Enum directory
Move SignRequestStatus from lib/Db/ to lib/Enum/ to follow project
convention of keeping all enums in a dedicated folder alongside
CRLStatus, CRLReason, CertificateType, and DocMdpLevel.

Updated namespace from OCA\Libresign\Db to OCA\Libresign\Enum and
adjusted all imports and references across:
- SignRequest entity (added import)
- ValidateHelper (updated FQN references)
- RequestSignatureService (updated FQN references)
- SequentialSigningService (updated import)
- SignFileService (updated FQN reference)

This improves code organization by consolidating all enum types in
one location.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 11:42:11 -03:00
Vitor Mattos
e5d703c51a
Merge pull request #6094 from LibreSign/fix/return-right-fields-when-save-a-new-file
fix: add status and created_at fields to file upload response
2025-12-11 11:28:00 -03:00
Vitor Mattos
3c223a06c2
feat: introduce FileStatus enum for type-safe status handling
Add FileStatus backed enum to provide compile-time type safety for file
status values. This replaces the previous int-based approach with a
proper enum that:

- Eliminates the need for default fallback in match expressions
- Provides IDE autocomplete for all valid status values
- Throws ValueError for invalid status codes instead of silently
  returning unknown status
- Accepts both int and FileStatus for backward compatibility

Updated getTextOfStatus() to use FileStatus enum with automatic
conversion from int via FileStatus::from(). Removed null return type
as status column is NOT NULL in database, ensuring statusText is
always a string.

This improves code maintainability and prevents invalid status values
from being used throughout the codebase.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 11:08:20 -03:00
Vitor Mattos
6a4f3d231d
Merge pull request #6095 from LibreSign/fix/optional-parameter-before-required
fix: correct parameter order in getUserConfigByKey method
2025-12-11 11:05:50 -03:00
Vitor Mattos
d3fde80329
fix: correct parameter order in getUserConfigByKey method
Optional parameter declared before required parameter causes implicit
required treatment. Changed method signature to put required parameter
$key before optional parameter $user, and updated all call sites.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 09:54:11 -03:00
Vitor Mattos
4a57a99dc6
docs: regenerate OpenAPI documentation
Update OpenAPI spec and TypeScript types to reflect changes in
LibresignNextcloudFile response type with status, statusText, and
created_at fields.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 09:47:55 -03:00
Vitor Mattos
8bc72d9616
docs: update LibresignNextcloudFile type definition
Update psalm type to reflect the actual fields returned by the
file upload endpoint: status, statusText, and created_at instead
of etag, path, and type.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 09:46:45 -03:00
Vitor Mattos
c2040e563a
fix: add status and created_at fields to file upload response
Return status, statusText and created_at in the API response after
file upload to display immediately in the files list without needing
to reload. Also removed unused etag, path and type fields.

Uses FileMapper to get status text and returns FileEntity directly
from save() method instead of additional database query.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-11 09:33:18 -03:00
Vitor Mattos
a8bb48e027
Merge pull request #6091 from LibreSign/fix/migration-sign-request-status
fix: Update migration to properly set SignRequest status
2025-12-11 09:31:54 -03:00
Nextcloud bot
1bd3dc79b8
fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2025-12-11 02:14:51 +00:00
Vitor Mattos
24542f28d5
fix: Update migration to properly set SignRequest status
- Add postSchemaChange method to migrate existing data
- Set status = 2 (SIGNED) when signed IS NOT NULL
- Set status = 1 (ABLE_TO_SIGN) when signed IS NULL and file.status = 1
- Status 0 (DRAFT) remains as default
- Only update records with status = 0 to avoid overwriting

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 19:07:55 -03:00
Vitor Mattos
da429d3ae3
Merge pull request #6088 from LibreSign/improvement/reorganize-sidebar-buttons
Reorganize sidebar buttons for better UX
2025-12-10 17:29:52 -03:00
Vitor Mattos
1659bf96c1
refactor: reorganize sidebar buttons for better UX
- Group buttons by context using flexbox with consistent spacing
- Reorder buttons to follow logical workflow
- Improve button hierarchy (max 1 primary button visible)
- Update labels for clarity
- Remove NcFormBox in favor of simpler flexbox layout

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 17:27:31 -03:00
Vitor Mattos
3270f87417
Merge pull request #6085 from LibreSign/fix/keep-sidebar-open-on-save
fix: keep sidebar open on save
2025-12-10 15:32:07 -03:00
Vitor Mattos
0cb0086566
refactor: remove unused event listeners for visible-elements-saved
Since the 'libresign:visible-elements-saved' event is no longer
emitted on draft saves, the event listeners and related methods
in Request.vue and FilesList.vue are no longer needed.

- Removed subscribe/unsubscribe calls
- Removed closeSidebar() methods
- Removed unused imports from @nextcloud/event-bus

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 15:22:58 -03:00
Vitor Mattos
4e30b9ce2c
fix: remove event emission on draft save to keep sidebar open
The 'libresign:visible-elements-saved' event was being emitted when
saving draft signatures, causing the sidebar to close unexpectedly.
This event should only be emitted when sending signature requests,
not when saving drafts.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 15:22:45 -03:00
Vitor Mattos
ec9c50796f
Merge pull request #6082 from LibreSign/fix/empty-state-with-filters
fix: improve empty state message when filters are active
2025-12-10 15:01:12 -03:00
Vitor Mattos
4b8da80d6b
fix: improve empty state message when filters are active
When filters are applied but return no results, the empty state
now displays 'No documents found' without the request button or
'Choose the file to request signatures' text.

This provides better UX by distinguishing between:
- No documents in the system (shows request button)
- Filters with no matches (shows only message)

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 14:59:54 -03:00
Vitor Mattos
0b43d58698
Merge pull request #6077 from LibreSign/fix/certificate-chain-toggle
fix: certificate chain toggle not working on button click
2025-12-10 14:28:07 -03:00
Vitor Mattos
5b5fe80961
fix: certificate chain toggle not working on button click
When clicking directly on the toggle button icon, the event was
not properly triggering the expand/collapse action. This fix adds
@click.stop to the NcButton to ensure the toggle action is executed
and prevents event bubbling issues.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 14:16:13 -03:00
Vitor Mattos
374b402fd9
Merge pull request #6074 from LibreSign/fix/multibyte-text-wrapping
fix: multibyte text wrapping
2025-12-10 14:15:58 -03:00
Vitor Mattos
dd2331915c
Merge pull request #6072 from LibreSign/dependabot/composer/vendor-bin/psalm/vimeo/psalm-6.14.1
chore(deps-dev): Bump vimeo/psalm from 6.13.1 to 6.14.1 in /vendor-bin/psalm
2025-12-10 14:02:52 -03:00
Vitor Mattos
a025bc90fd
test: add multibyte text wrapping test cases
Add test cases for Portuguese text with accents to verify that the
multibyte-safe wordwrap implementation correctly handles text with
diacritical marks and other Unicode characters in signature images.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 14:01:58 -03:00
Vitor Mattos
714f424d7c
fix: replace wordwrap with multibyte-safe implementation
The native PHP wordwrap() function does not handle multibyte characters
correctly, causing text with accents, CJK characters, or emojis to be
wrapped at incorrect positions.

This commit introduces mbWordwrap(), a custom implementation that uses
mb_strlen() and mb_substr() to properly handle UTF-8 and multibyte
text wrapping in signature images.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 14:01:39 -03:00
dependabot[bot]
5388ed1d6a
chore(deps-dev): Bump vimeo/psalm in /vendor-bin/psalm
Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 6.13.1 to 6.14.1.
- [Release notes](https://github.com/vimeo/psalm/releases)
- [Commits](https://github.com/vimeo/psalm/compare/6.13.1...6.14.1)

---
updated-dependencies:
- dependency-name: vimeo/psalm
  dependency-version: 6.14.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-10 16:37:24 +00:00
Vitor Mattos
4c774f2c72
Merge pull request #6073 from LibreSign/dependabot/github_actions/peter-evans/create-pull-request-8.0.0
chore(deps): Bump peter-evans/create-pull-request from 7.0.11 to 8.0.0
2025-12-10 13:35:44 -03:00
dependabot[bot]
231b42589d
chore(deps): Bump peter-evans/create-pull-request from 7.0.11 to 8.0.0
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 7.0.11 to 8.0.0.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](22a9089034...98357b18bf)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-10 16:22:56 +00:00
Vitor Mattos
20a6616c12
Merge pull request #6069 from LibreSign/feat/sequential-signing
feat: sequential signing
2025-12-10 12:40:17 -03:00
Vitor Mattos
5caf995ab8
chore: update OpenAPI schemas with signingOrder field
Auto-generated update of OpenAPI schemas to include the signingOrder
field in NewSigner and Signer types.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 12:31:01 -03:00
Vitor Mattos
af5b9bf14c
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 <1079143+vitormattos@users.noreply.github.com>
2025-12-10 12:29:58 -03:00
Vitor Mattos
70e7c3533c
feat: add signingOrder to OpenAPI schema definitions
Add signingOrder field to LibresignSigner and LibresignNewSigner
schemas to support ordered signature flow in API documentation.

This fixes OpenAPI validation errors in API tests that were failing
because the signingOrder field was being returned but not defined
in the schema.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 12:19:40 -03:00
Vitor Mattos
3a44e0a8df
test: fix signature-flow endpoint URL in integration test
Update Behat test to use correct endpoint URL and parameter name:
- Changed from '/api/v1/admin/signature-flow' to '/api/v1/admin/signature-flow/config'
- Changed parameter from 'flow' to 'mode'

This aligns with the actual AdminController endpoint implementation.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 12:11:29 -03:00
Vitor Mattos
c86cb4a6ed
fix: only notify signers with ABLE_TO_SIGN status in sequential flow
In ordered_numeric signature flow, all signers were receiving
notifications regardless of their status. This caused signers
with signing_order > 1 (status DRAFT) to be notified immediately.

Changes:
- Update SignRequest status on PATCH operations, not just INSERT
- Only notify signers when status is ABLE_TO_SIGN
- Ensure signers with order > 1 remain in DRAFT status until
  previous orders are completed

This ensures notifications are sent only to signers who can
actually sign at that moment.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 11:59:16 -03:00
Vitor Mattos
9688265954
feat: add manual signing order input with auto-save
Add NcActionInput for manual signing order entry with dual-mode
behavior: updateSigningOrder for visual reordering during typing,
confirmSigningOrder for normalization and persistence on submit/blur.
Implement debounced auto-save (1000ms) after drag-and-drop or manual
order changes. Listen to signing-order-changed event from Signers
component using Vue $emit pattern.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-10 11:50:05 -03:00