diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 0936d60b9ccea..273dd30f7ef7d 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -2065,8 +2065,14 @@ private function checkInheritedAttributes(IShare $share): void { /** * Send a mail notification again for a share. * The mail_send option must be enabled for the given share. - * @param string $id + * @param string $id the share ID * @param string $password optional, the password to check against. Necessary for password protected shares. + * @throws OCSNotFoundException Share not found + * @throws OCSForbiddenException You are not allowed to send mail notifications + * @throws OCSBadRequestException Invalid request or wrong password + * @throws OCSException Error while sending mail notification + * @return DataResponse, array{}> + * 200: The email notification was sent successfully */ #[NoAdminRequired] #[UserRateLimit(limit: 5, period: 120)] @@ -2110,7 +2116,7 @@ public function sendShareEmail(string $id, $password = ''): DataResponse { } $provider->sendMailNotification($share); - return new DataResponse(['message' => 'ok']); + return new DataResponse(); } catch(OCSBadRequestException $e) { throw $e; } catch (Exception $e) { diff --git a/apps/files_sharing/openapi.json b/apps/files_sharing/openapi.json index 65beb9121b879..8669fdcc8e15e 100644 --- a/apps/files_sharing/openapi.json +++ b/apps/files_sharing/openapi.json @@ -1755,6 +1755,15 @@ "type": "string", "nullable": true, "description": "Additional attributes for the share" + }, + "sendMail": { + "type": "string", + "nullable": true, + "enum": [ + "false", + "true" + ], + "description": "Send a mail to the recipient" } } } @@ -2256,6 +2265,11 @@ "type": "string", "nullable": true, "description": "New additional attributes" + }, + "sendMail": { + "type": "string", + "nullable": true, + "description": "if the share should be send by mail.\n Considering the share already exists, no mail will be send after the share is updated.\n \t\t\t\t You will have to use the sendMail action to send the mail." } } } @@ -2523,6 +2537,175 @@ } } }, + "/ocs/v2.php/apps/files_sharing/api/v1/shares/{id}/send-email": { + "post": { + "operationId": "shareapi-send-share-email", + "summary": "Send a mail notification again for a share. The mail_send option must be enabled for the given share.", + "tags": [ + "shareapi" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "password": { + "type": "string", + "default": "", + "description": "optional, the password to check against. Necessary for password protected shares." + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "the share ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "404": { + "description": "Share not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "You are not allowed to send mail notifications", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "400": { + "description": "Invalid request or wrong password", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "200": { + "description": "The email notification was sent successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, "/ocs/v2.php/apps/files_sharing/api/v1/shares/pending/{id}": { "post": { "operationId": "shareapi-accept-share", diff --git a/apps/files_sharing/src/components/NewFileRequestDialog.vue b/apps/files_sharing/src/components/NewFileRequestDialog.vue index b0a969c25f1e7..6f5044d21e5ab 100644 --- a/apps/files_sharing/src/components/NewFileRequestDialog.vue +++ b/apps/files_sharing/src/components/NewFileRequestDialog.vue @@ -41,7 +41,7 @@ @@ -103,8 +103,9 @@