aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_status/lib
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2023-11-15 17:30:57 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2023-11-16 12:45:22 +0100
commitbdad290d31b9f2696158a0839b2879c7f3f47a02 (patch)
tree6ca39edc2d26a420b103fe039e1f19d97a4132e7 /apps/user_status/lib
parent9c3350b3131312e60155c26a8a15b95981c6dd0a (diff)
downloadnextcloud-server-bdad290d31b9f2696158a0839b2879c7f3f47a02.tar.gz
nextcloud-server-bdad290d31b9f2696158a0839b2879c7f3f47a02.zip
fix(userstatus): Only track message timestamp for values
Do not track status messages that are empty, e.g. DND outside of availability. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/user_status/lib')
-rw-r--r--apps/user_status/lib/Db/UserStatus.php2
-rw-r--r--apps/user_status/lib/Service/StatusService.php8
2 files changed, 8 insertions, 2 deletions
diff --git a/apps/user_status/lib/Db/UserStatus.php b/apps/user_status/lib/Db/UserStatus.php
index 92b3df740c2..f7742a4bbe9 100644
--- a/apps/user_status/lib/Db/UserStatus.php
+++ b/apps/user_status/lib/Db/UserStatus.php
@@ -50,7 +50,7 @@ use OCP\AppFramework\Db\Entity;
* @method void setCustomMessage(string|null $customMessage)
* @method int|null getClearAt()
* @method void setClearAt(int|null $clearAt)
- * @method setIsBackup(bool $true): void
+ * @method setIsBackup(bool $isBackup): void
* @method getIsBackup(): bool
* @method int getStatusMessageTimestamp()
* @method void setStatusMessageTimestamp(int $statusTimestamp)
diff --git a/apps/user_status/lib/Service/StatusService.php b/apps/user_status/lib/Service/StatusService.php
index 508d9287555..99fafaa6426 100644
--- a/apps/user_status/lib/Service/StatusService.php
+++ b/apps/user_status/lib/Service/StatusService.php
@@ -314,7 +314,13 @@ class StatusService {
$userStatus->setCustomIcon(null);
$userStatus->setCustomMessage($customMessage);
$userStatus->setClearAt(null);
- $userStatus->setStatusMessageTimestamp($this->timeFactory->now()->getTimestamp());
+ if ($this->predefinedStatusService->getTranslatedStatusForId($messageId) !== null
+ || ($customMessage !== null && $customMessage !== '')) {
+ // Only track status message ID if there is one
+ $userStatus->setStatusMessageTimestamp($this->timeFactory->now()->getTimestamp());
+ } else {
+ $userStatus->setStatusMessageTimestamp(0);
+ }
if ($userStatus->getId() !== null) {
return $this->mapper->update($userStatus);