aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_status/lib/Service
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-05-27 11:28:59 +0200
committerJoas Schilling <coding@schilljs.com>2022-05-27 11:32:53 +0200
commit1429a9a8ef9c65493e0c9276c4cc5f8b8cf94bc2 (patch)
treea2df0b1ca7fed35bc368e09854e4f25c8136aa15 /apps/user_status/lib/Service
parent9ad5b301ce716d4033e9cbc549aff2a43d5022f5 (diff)
downloadnextcloud-server-1429a9a8ef9c65493e0c9276c4cc5f8b8cf94bc2.tar.gz
nextcloud-server-1429a9a8ef9c65493e0c9276c4cc5f8b8cf94bc2.zip
Also reset the status on clearAt
When you set yourself to "DND - In a meeting" for one hour, the expectation is that you are also "online"/normal again when the meeting is over. So we extend the logic to also include the status itself to be reverted. Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/user_status/lib/Service')
-rw-r--r--apps/user_status/lib/Service/StatusService.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/user_status/lib/Service/StatusService.php b/apps/user_status/lib/Service/StatusService.php
index 9bf448d9de8..858db48f31f 100644
--- a/apps/user_status/lib/Service/StatusService.php
+++ b/apps/user_status/lib/Service/StatusService.php
@@ -302,7 +302,7 @@ class StatusService {
/**
* @param string $userId
* @param string|null $statusIcon
- * @param string $message
+ * @param string|null $message
* @param int|null $clearAt
* @return UserStatus
* @throws InvalidClearAtException
@@ -311,7 +311,7 @@ class StatusService {
*/
public function setCustomMessage(string $userId,
?string $statusIcon,
- string $message,
+ ?string $message,
?int $clearAt): UserStatus {
try {
$userStatus = $this->mapper->findByUserId($userId);
@@ -328,7 +328,7 @@ class StatusService {
throw new InvalidStatusIconException('Status-Icon is longer than one character');
}
// Check for maximum length of custom message
- if (\mb_strlen($message) > self::MAXIMUM_MESSAGE_LENGTH) {
+ if ($message !== null && \mb_strlen($message) > self::MAXIMUM_MESSAGE_LENGTH) {
throw new StatusMessageTooLongException('Message is longer than supported length of ' . self::MAXIMUM_MESSAGE_LENGTH . ' characters');
}
// Check that clearAt is in the future
@@ -432,6 +432,7 @@ class StatusService {
$this->cleanStatus($status);
}
if ($clearAt !== null && $clearAt < $this->timeFactory->getTime()) {
+ $this->cleanStatus($status);
$this->cleanStatusMessage($status);
}
if ($status->getMessageId() !== null) {