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
8 changes: 5 additions & 3 deletions lib/Controller/APIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function generateNotificationV3(
*
* Required capability: `ocs-endpoints > test-push`
*
* @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, array{message: string}, array{}>
* @return DataResponse<Http::STATUS_OK, array{message: string, nid: int}, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array{message: string}, array{}>
*
* 200: Test notification generated successfully, but the device should still show the message to the user
* 400: Test notification could not be generated, show the message to the user
Expand Down Expand Up @@ -208,14 +208,16 @@ public function selfTestPush(): DataResponse {

$this->notificationApp->setOutput($output);
$this->notificationManager->notify($notification);

/** @var int $nid */
$nid = $this->notificationApp->getLastInsertedId();
return new DataResponse(['message' => $output->fetch(), 'nid' => $nid]);
} catch (\InvalidArgumentException $e) {
$this->logger->error('Self testing push notification failed: ' . $e->getMessage(), ['exception' => $e]);
return new DataResponse(
['message' => $this->l->t('An unexpected error occurred, ask your administration to check the logs.')],
Http::STATUS_BAD_REQUEST,
);
}

return new DataResponse(['message' => $output->fetch()]);
}
}
7 changes: 6 additions & 1 deletion openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -1514,11 +1514,16 @@
"data": {
"type": "object",
"required": [
"message"
"message",
"nid"
],
"properties": {
"message": {
"type": "string"
},
"nid": {
"type": "integer",
"format": "int64"
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion openapi-push.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,16 @@
"data": {
"type": "object",
"required": [
"message"
"message",
"nid"
],
"properties": {
"message": {
"type": "string"
},
"nid": {
"type": "integer",
"format": "int64"
}
}
}
Expand Down