diff options
Diffstat (limited to 'apps/user_status/lib/Controller/HeartbeatController.php')
-rw-r--r-- | apps/user_status/lib/Controller/HeartbeatController.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/apps/user_status/lib/Controller/HeartbeatController.php b/apps/user_status/lib/Controller/HeartbeatController.php index 223ff4a0f45..c11a63b4420 100644 --- a/apps/user_status/lib/Controller/HeartbeatController.php +++ b/apps/user_status/lib/Controller/HeartbeatController.php @@ -81,21 +81,21 @@ class HeartbeatController extends Controller { return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); } - $this->eventDispatcher->dispatchTyped( - new UserLiveStatusEvent( - $user, - $status, - $this->timeFactory->getTime() - ) + $event = new UserLiveStatusEvent( + $user, + $status, + $this->timeFactory->getTime() ); - try { - $userStatus = $this->service->findByUserId($user->getUID()); - } catch (DoesNotExistException $ex) { + $this->eventDispatcher->dispatchTyped($event); + + $userStatus = $event->getUserStatus(); + if (!$userStatus) { return new JSONResponse([], Http::STATUS_NO_CONTENT); } - return new JSONResponse($this->formatStatus($userStatus)); + /** @psalm-suppress UndefinedInterfaceMethod */ + return new JSONResponse($this->formatStatus($userStatus->getInternal())); } private function formatStatus(UserStatus $status): array { |