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
14 changes: 7 additions & 7 deletions apps/user_status/lib/Controller/HeartbeatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
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;
Expand Down Expand Up @@ -70,16 +70,16 @@ public function __construct(string $appName,
* @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(
Expand All @@ -92,11 +92,11 @@ public function heartbeat(string $status): JSONResponse {

$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 {
Expand Down
2 changes: 1 addition & 1 deletion apps/user_status/src/services/heartbeatService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions dist/user_status-menu.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/user_status-menu.js.map

Large diffs are not rendered by default.