aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2023-01-25 08:51:55 +0100
committerGitHub <noreply@github.com>2023-01-25 08:51:55 +0100
commitd51429a47232bbf46a2be832ecfa711f102da802 (patch)
treeaf8d9bf3d506c9cb7086d7ca58353d4870e0ef11 /apps
parentd66bf39de5b37e6269b77c8af7865233c1a40ab2 (diff)
parent1f49a56a98ac7d08608ed895f6843caab9c0242c (diff)
downloadnextcloud-server-d51429a47232bbf46a2be832ecfa711f102da802.tar.gz
nextcloud-server-d51429a47232bbf46a2be832ecfa711f102da802.zip
Merge pull request #36216 from nextcloud/fix/user_status-heartbeat-response
Fix user_status heartbeat response
Diffstat (limited to 'apps')
-rw-r--r--apps/user_status/lib/Controller/HeartbeatController.php14
-rw-r--r--apps/user_status/src/services/heartbeatService.js2
2 files changed, 8 insertions, 8 deletions
diff --git a/apps/user_status/lib/Controller/HeartbeatController.php b/apps/user_status/lib/Controller/HeartbeatController.php
index 82978f0983a..e0b735f044f 100644
--- a/apps/user_status/lib/Controller/HeartbeatController.php
+++ b/apps/user_status/lib/Controller/HeartbeatController.php
@@ -30,7 +30,7 @@ use OCA\UserStatus\Service\StatusService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http;
-use OCP\AppFramework\Http\JSONResponse;
+use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\EventDispatcher\IEventDispatcher;
@@ -70,16 +70,16 @@ class HeartbeatController extends OCSController {
* @NoAdminRequired
*
* @param string $status
- * @return JSONResponse
+ * @return DataResponse
*/
- public function heartbeat(string $status): JSONResponse {
+ public function heartbeat(string $status): DataResponse {
if (!\in_array($status, [IUserStatus::ONLINE, IUserStatus::AWAY], true)) {
- return new JSONResponse([], Http::STATUS_BAD_REQUEST);
+ return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
$user = $this->userSession->getUser();
if ($user === null) {
- return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
+ return new DataResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
}
$event = new UserLiveStatusEvent(
@@ -92,11 +92,11 @@ class HeartbeatController extends OCSController {
$userStatus = $event->getUserStatus();
if (!$userStatus) {
- return new JSONResponse([], Http::STATUS_NO_CONTENT);
+ return new DataResponse([], Http::STATUS_NO_CONTENT);
}
/** @psalm-suppress UndefinedInterfaceMethod */
- return new JSONResponse($this->formatStatus($userStatus->getInternal()));
+ return new DataResponse($this->formatStatus($userStatus->getInternal()));
}
private function formatStatus(UserStatus $status): array {
diff --git a/apps/user_status/src/services/heartbeatService.js b/apps/user_status/src/services/heartbeatService.js
index 8c429c45049..6a033f7789b 100644
--- a/apps/user_status/src/services/heartbeatService.js
+++ b/apps/user_status/src/services/heartbeatService.js
@@ -34,7 +34,7 @@ const sendHeartbeat = async (isAway) => {
const response = await HttpClient.put(url, {
status: isAway ? 'away' : 'online',
})
- return response.data
+ return response.data.ocs.data
}
export {