From 92fe694b7f088b0aea797b83506e4ad18a061dbf Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 19 Nov 2021 15:09:05 +0100 Subject: Fix multiple bugs with user status * Fix editing the status while on a call, don't send a bogus request * Clean backup user status when setting up a new status manually * A bit more type hinting Signed-off-by: Carl Schwan --- apps/user_status/lib/Controller/UserStatusController.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apps/user_status/lib/Controller/UserStatusController.php') diff --git a/apps/user_status/lib/Controller/UserStatusController.php b/apps/user_status/lib/Controller/UserStatusController.php index a231103e91e..8708a7c2aac 100644 --- a/apps/user_status/lib/Controller/UserStatusController.php +++ b/apps/user_status/lib/Controller/UserStatusController.php @@ -99,6 +99,8 @@ class UserStatusController extends OCSController { public function setStatus(string $statusType): DataResponse { try { $status = $this->service->setStatus($this->userId, $statusType, null, true); + + $this->service->removeBackupUserStatus($this->userId); return new DataResponse($this->formatStatus($status)); } catch (InvalidStatusTypeException $ex) { $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid status type "' . $statusType . '"'); @@ -118,6 +120,7 @@ class UserStatusController extends OCSController { ?int $clearAt): DataResponse { try { $status = $this->service->setPredefinedMessage($this->userId, $messageId, $clearAt); + $this->service->removeBackupUserStatus($this->userId); return new DataResponse($this->formatStatus($status)); } catch (InvalidClearAtException $ex) { $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid clearAt value "' . $clearAt . '"'); @@ -147,6 +150,7 @@ class UserStatusController extends OCSController { $this->service->clearMessage($this->userId); $status = $this->service->findByUserId($this->userId); } + $this->service->removeBackupUserStatus($this->userId); return new DataResponse($this->formatStatus($status)); } catch (InvalidClearAtException $ex) { $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid clearAt value "' . $clearAt . '"'); -- cgit v1.2.3