fix(user_status): Catch non-existing user status when setting custom user status

Signed-off-by: provokateurin <kate@provokateurin.de>
pull/49797/head
provokateurin 2024-12-11 10:23:02 +07:00
parent 654a7d22ff
commit 5c360e0367
No known key found for this signature in database
2 changed files with 31 additions and 0 deletions

@ -123,6 +123,7 @@ class UserStatusController extends OCSController {
* @param int|null $clearAt When the message should be cleared
* @return DataResponse<Http::STATUS_OK, UserStatusPrivate, array{}>
* @throws OCSBadRequestException The clearAt or icon is invalid or the message is too long
* @throws OCSNotFoundException No status for the current user
*
* 200: The message was updated successfully
*/
@ -149,6 +150,8 @@ class UserStatusController extends OCSController {
} catch (StatusMessageTooLongException $ex) {
$this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to a too long status message.');
throw new OCSBadRequestException($ex->getMessage(), $ex);
} catch (DoesNotExistException $ex) {
throw new OCSNotFoundException('No status for the current user');
}
}

@ -1016,6 +1016,34 @@
}
}
}
},
"404": {
"description": "No status for the current user",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
}