- Add getLabel() method to FileStatus enum similar to DocMdpLevel and SignRequestStatus
- Simplify FileMapper::getTextOfStatus() to delegate to enum's getLabel()
- Improves maintainability by centralizing translations in a single place
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Changed condition from checking 'uuid' to 'nodeId' in delete method
- Added logic to close sidebar when the deleted file is the currently selected one
- Simplified deleteMultiple method to rely on delete method's cleanup
This fixes the issue where the sidebar remained open after deleting
the only/selected file, both when the file was just uploaded or when
the page was already loaded.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Split the sequential signing test into two separate scenarios to better
validate the DRAFT status filtering behavior:
1. First scenario: Tests that signer1 can see and sign the document
(simpler flow without multiple user switches)
2. Second scenario: Tests that signer2 does NOT see the document when
their sign_request is in DRAFT status
This avoids multiple user context switches in the same scenario which
was causing authentication issues in the Behat tests, and better isolates
the behavior we want to validate.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Filter out sign_requests with status DRAFT (0) in the file list endpoint
when the user is not the file owner. This ensures that signers do not
see documents where their sign_request is in DRAFT status, unless they
are the requester (owner) of the document.
The filter is applied in the getFilesAssociatedFilesWithMeQueryBuilder
method by adding conditions to exclude:
- Files with status DRAFT (0)
- Sign requests with status DRAFT (0)
Only when the user is not the file owner (not matching f.user_id).
This change affects only the /api/v1/file/list endpoint and does not
impact other file access methods or signature flows.
Ref: Security improvement to prevent premature document visibility
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Replace custom Bullet component with NcChip from @nextcloud/vue
- Remove unused Bullet component
- Fix reactivity issue by passing signerIndex instead of currentSigner
- Signer component now fetches data from store reactively using computed property
- This ensures changes in store are properly reflected in the UI
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Replace indicator circle with NcChip component
- Add status-based chip types (success, warning, secondary)
- Add Material Design Icons for different statuses
- Improve layout with flexbox for better alignment
- Remove timestamp display in favor of status text
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Include status, statusText, and created_at in file data
- Improve state management for newly created signature requests
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Show 'Request signature' button for draft status (status === 0)
- Show 'Send reminder' button for pending status (status === 1)
- Implement requestSignatureForSigner method to update signer status
- Use signRequestId instead of identify for signer identification
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add status parameter with default value 1
- Make method more flexible for different status transitions
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
The FileService now includes status and statusText fields in the signer
data structure when processing signed files outside LibreSign. This
update adjusts the test expectations to match the actual behavior.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
When adding a new signer with status 0, the backend was ignoring it
because empty() treated 0 as falsy. Changed to isset() to properly
handle status 0.
Also updated determineInitialStatus() to allow new signers to be
added in DRAFT mode even when the file is not in DRAFT status,
allowing gradual signer addition before requesting signatures.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
When identification method is email and person has no account,
notification was being blocked by activity check for non-existent user.
Now checks if user exists before verifying activity notification settings.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>