diff options
author | Carl Schwan <carl@carlschwan.eu> | 2021-11-19 15:09:05 +0100 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2021-11-23 12:21:42 +0100 |
commit | 92fe694b7f088b0aea797b83506e4ad18a061dbf (patch) | |
tree | 05eddd0931cc6b377a0e0c3dc9b56c609526f420 /apps/user_status/lib/Controller/UserStatusController.php | |
parent | c35ad0c20d420c3056565c6bad21133dc035b2df (diff) | |
download | nextcloud-server-92fe694b7f088b0aea797b83506e4ad18a061dbf.tar.gz nextcloud-server-92fe694b7f088b0aea797b83506e4ad18a061dbf.zip |
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 <carl@carlschwan.eu>
Diffstat (limited to 'apps/user_status/lib/Controller/UserStatusController.php')
-rw-r--r-- | apps/user_status/lib/Controller/UserStatusController.php | 4 |
1 files changed, 4 insertions, 0 deletions
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 . '"'); |