From 32b577a5df926b7de030e6d7abb5c7fe2f1c171a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 30 Sep 2020 14:12:02 +0200 Subject: Reset the user status when clearing the custom message Signed-off-by: Joas Schilling --- apps/user_status/lib/Controller/UserStatusController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apps/user_status/lib/Controller') diff --git a/apps/user_status/lib/Controller/UserStatusController.php b/apps/user_status/lib/Controller/UserStatusController.php index ffbe1e753ef..950cafb104d 100644 --- a/apps/user_status/lib/Controller/UserStatusController.php +++ b/apps/user_status/lib/Controller/UserStatusController.php @@ -138,7 +138,12 @@ class UserStatusController extends OCSController { string $message, ?int $clearAt): DataResponse { try { - $status = $this->service->setCustomMessage($this->userId, $statusIcon, $message, $clearAt); + if ($message !== '') { + $status = $this->service->setCustomMessage($this->userId, $statusIcon, $message, $clearAt); + } else { + $this->service->clearMessage($this->userId); + $status = $this->service->findByUserId($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