Skip to content

Commit

Permalink
feat: add list of sent notifications to a signer
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Dec 29, 2024
1 parent 84e7038 commit 0440990
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,18 @@
* emailToken?: LibresignSignatureMethodEmailToken,
* password?: LibresignSignatureMethodPassword,
* }
* @psalm-type LibresignNotify = array{
* date: int,
* method: "activity"|"notify"|"mail",
* }
* @psalm-type LibresignSigner = array{
* description: ?string,
* displayName: string,
* request_sign_date: string,
* email?: string,
* remote_address?: string,
* user_agent?: string,
* notify?: LibresignNotify[],
* userId?: string,
* signed: ?string,
* sign_date?: ?string,
Expand Down
3 changes: 3 additions & 0 deletions lib/Service/FileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ private function getSigners(): array {
if (!empty($metadata['user-agent'])) {
$signatureToShow['user_agent'] = $metadata['user-agent'];
}
if (!empty($metadata['notify'])) {
$signatureToShow['notify'] = $metadata['notify'];
}
if ($signer->getSigned()) {
$data['sign_date'] = (new \DateTime())
->setTimestamp($signer->getSigned())
Expand Down
33 changes: 33 additions & 0 deletions openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,27 @@
}
}
},
"Notify": {
"type": "object",
"required": [
"date",
"method"
],
"properties": {
"date": {
"type": "integer",
"format": "int64"
},
"method": {
"type": "string",
"enum": [
"activity",
"notify",
"mail"
]
}
}
},
"OCSMeta": {
"type": "object",
"required": [
Expand Down Expand Up @@ -704,6 +725,18 @@
"email": {
"type": "string"
},
"remote_address": {
"type": "string"
},
"user_agent": {
"type": "string"
},
"notify": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Notify"
}
},
"userId": {
"type": "string"
},
Expand Down
33 changes: 33 additions & 0 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,27 @@
}
}
},
"Notify": {
"type": "object",
"required": [
"date",
"method"
],
"properties": {
"date": {
"type": "integer",
"format": "int64"
},
"method": {
"type": "string",
"enum": [
"activity",
"notify",
"mail"
]
}
}
},
"OCSMeta": {
"type": "object",
"required": [
Expand Down Expand Up @@ -608,6 +629,18 @@
"email": {
"type": "string"
},
"remote_address": {
"type": "string"
},
"user_agent": {
"type": "string"
},
"notify": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Notify"
}
},
"userId": {
"type": "string"
},
Expand Down
9 changes: 9 additions & 0 deletions src/types/openapi/openapi-full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,12 @@ export type components = {
path: string;
type: string;
};
Notify: {
/** Format: int64 */
date: number;
/** @enum {string} */
method: "activity" | "notify" | "mail";
};
OCSMeta: {
status: string;
statuscode: number;
Expand Down Expand Up @@ -1234,6 +1240,9 @@ export type components = {
displayName: string;
request_sign_date: string;
email?: string;
remote_address?: string;
user_agent?: string;
notify?: components["schemas"]["Notify"][];
userId?: string;
signed: string | null;
sign_date?: string | null;
Expand Down
9 changes: 9 additions & 0 deletions src/types/openapi/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,12 @@ export type components = {
path: string;
type: string;
};
Notify: {
/** Format: int64 */
date: number;
/** @enum {string} */
method: "activity" | "notify" | "mail";
};
OCSMeta: {
status: string;
statuscode: number;
Expand Down Expand Up @@ -1088,6 +1094,9 @@ export type components = {
displayName: string;
request_sign_date: string;
email?: string;
remote_address?: string;
user_agent?: string;
notify?: components["schemas"]["Notify"][];
userId?: string;
signed: string | null;
sign_date?: string | null;
Expand Down

0 comments on commit 0440990

Please sign in to comment.