aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_status/lib/Controller
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2023-12-29 18:11:35 +0100
committerprovokateurin <kate@provokateurin.de>2024-01-10 09:03:29 +0100
commitcbc27d3ca7a0c17ca0f95b5618c7b997b02af63f (patch)
tree112e35be81a81c49897469359ae4b7968427cca5 /apps/user_status/lib/Controller
parentb15b12d5ecd65f6586332753f20b3c82f4dd82a5 (diff)
downloadnextcloud-server-cbc27d3ca7a0c17ca0f95b5618c7b997b02af63f.tar.gz
nextcloud-server-cbc27d3ca7a0c17ca0f95b5618c7b997b02af63f.zip
feat(user_status): Add online status type for OpenAPI
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps/user_status/lib/Controller')
-rw-r--r--apps/user_status/lib/Controller/StatusesController.php2
-rw-r--r--apps/user_status/lib/Controller/UserStatusController.php5
2 files changed, 6 insertions, 1 deletions
diff --git a/apps/user_status/lib/Controller/StatusesController.php b/apps/user_status/lib/Controller/StatusesController.php
index ff9008d1b70..b506a691a61 100644
--- a/apps/user_status/lib/Controller/StatusesController.php
+++ b/apps/user_status/lib/Controller/StatusesController.php
@@ -39,6 +39,7 @@ use OCP\IRequest;
use OCP\UserStatus\IUserStatus;
/**
+ * @psalm-import-type UserStatusType from ResponseDefinitions
* @psalm-import-type UserStatusPublic from ResponseDefinitions
*/
class StatusesController extends OCSController {
@@ -105,6 +106,7 @@ class StatusesController extends OCSController {
* @return UserStatusPublic
*/
private function formatStatus(UserStatus $status): array {
+ /** @var UserStatusType $visibleStatus */
$visibleStatus = $status->getStatus();
if ($visibleStatus === IUserStatus::INVISIBLE) {
$visibleStatus = IUserStatus::OFFLINE;
diff --git a/apps/user_status/lib/Controller/UserStatusController.php b/apps/user_status/lib/Controller/UserStatusController.php
index 3beb8abc3ab..053b07664a5 100644
--- a/apps/user_status/lib/Controller/UserStatusController.php
+++ b/apps/user_status/lib/Controller/UserStatusController.php
@@ -47,6 +47,7 @@ use OCP\IRequest;
use Psr\Log\LoggerInterface;
/**
+ * @psalm-import-type UserStatusType from ResponseDefinitions
* @psalm-import-type UserStatusPrivate from ResponseDefinitions
*/
class UserStatusController extends OCSController {
@@ -207,6 +208,8 @@ class UserStatusController extends OCSController {
* @return UserStatusPrivate
*/
private function formatStatus(UserStatus $status): array {
+ /** @var UserStatusType $visibleStatus */
+ $visibleStatus = $status->getStatus();
return [
'userId' => $status->getUserId(),
'message' => $status->getCustomMessage(),
@@ -214,7 +217,7 @@ class UserStatusController extends OCSController {
'messageIsPredefined' => $status->getMessageId() !== null,
'icon' => $status->getCustomIcon(),
'clearAt' => $status->getClearAt(),
- 'status' => $status->getStatus(),
+ 'status' => $visibleStatus,
'statusIsUserDefined' => $status->getIsUserDefined(),
];
}