Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions lib/Db/FileMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,20 +250,7 @@ public function getTextOfStatus(int|FileStatus $status): string {
if (is_int($status)) {
$status = FileStatus::from($status);
}
return match ($status) {
// TRANSLATORS Name of the status when document is not a LibreSign file
FileStatus::NOT_LIBRESIGN_FILE => $this->l->t('not LibreSign file'),
// TRANSLATORS Name of the status that the document is still as a draft
FileStatus::DRAFT => $this->l->t('draft'),
// TRANSLATORS Name of the status that the document can be signed
FileStatus::ABLE_TO_SIGN => $this->l->t('available for signature'),
// TRANSLATORS Name of the status when the document has already been partially signed
FileStatus::PARTIAL_SIGNED => $this->l->t('partially signed'),
// TRANSLATORS Name of the status when the document has been completely signed
FileStatus::SIGNED => $this->l->t('signed'),
// TRANSLATORS Name of the status when the document was deleted
FileStatus::DELETED => $this->l->t('deleted'),
};
return $status->getLabel($this->l);
}

public function neutralizeDeletedUser(string $userId, string $displayName): void {
Expand Down
19 changes: 19 additions & 0 deletions lib/Enum/FileStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace OCA\Libresign\Enum;

use OCP\IL10N;

/**
* File status enum
*
Expand All @@ -21,4 +23,21 @@ enum FileStatus: int {
case PARTIAL_SIGNED = 2;
case SIGNED = 3;
case DELETED = 4;

public function getLabel(IL10N $l10n): string {
return match($this) {
// TRANSLATORS Name of the status when document is not a LibreSign file
self::NOT_LIBRESIGN_FILE => $l10n->t('not LibreSign file'),
// TRANSLATORS Name of the status that the document is still as a draft
self::DRAFT => $l10n->t('draft'),
// TRANSLATORS Name of the status that the document can be signed
self::ABLE_TO_SIGN => $l10n->t('available for signature'),
// TRANSLATORS Name of the status when the document has already been partially signed
self::PARTIAL_SIGNED => $l10n->t('partially signed'),
// TRANSLATORS Name of the status when the document has been completely signed
self::SIGNED => $l10n->t('signed'),
// TRANSLATORS Name of the status when the document was deleted
self::DELETED => $l10n->t('deleted'),
};
}
}
Loading