diff options
author | Joas Schilling <coding@schilljs.com> | 2020-09-17 10:59:03 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-09-17 11:00:04 +0300 |
commit | 291e2c75f7b97cd8c1194b5a54cbf6b97193e981 (patch) | |
tree | e2f224a8bcdefbcec7e429d0aa412a1d15486f34 | |
parent | 9e0d759485458e3d2dfce4b3bb8f4733510689c3 (diff) |
Add a header and publish all status information
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/Controller/ChatController.php | 1 | ||||
-rw-r--r-- | lib/Controller/RoomController.php | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index fafc7a66a..5777a1bd1 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -488,6 +488,7 @@ class ChatController extends AEnvironmentAwareController { $data['status'] = $statuses[$data['id']]->getStatus(); $data['statusIcon'] = $statuses[$data['id']]->getIcon(); $data['statusMessage'] = $statuses[$data['id']]->getMessage(); + $data['statusClearAt'] = $statuses[$data['id']]->getClearAt(); } $output[] = $data; diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index 84843edae..766d6a4d8 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -838,15 +838,16 @@ class RoomController extends AEnvironmentAwareController { $maxPingAge = $this->timeFactory->getTime() - 100; $participants = $this->room->getParticipantsLegacy(); - $results = []; + $results = $headers = $statuses = []; - $statuses = []; if ($this->userId !== null && $includeStatus && count($participants['users']) < 100 && $this->appManager->isEnabledForUser('user_status')) { $userIds = array_map('strval', array_keys($participants['users'])); $statuses = $this->statusManager->getUserStatuses($userIds); + + $headers['X-Nextcloud-Has-User-Statuses'] = true; } foreach ($participants['users'] as $userId => $participant) { @@ -867,6 +868,7 @@ class RoomController extends AEnvironmentAwareController { $participant['status'] = $statuses[$userId]->getStatus(); $participant['statusIcon'] = $statuses[$userId]->getIcon(); $participant['statusMessage'] = $statuses[$userId]->getMessage(); + $participant['statusClearAt'] = $statuses[$userId]->getClearAt(); } $results[] = $participant; @@ -895,7 +897,7 @@ class RoomController extends AEnvironmentAwareController { $this->room->cleanGuestParticipants(); } - return new DataResponse($results); + return new DataResponse($results, Http::STATUS_OK, $headers); } /** |