aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_status/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_status/lib')
-rw-r--r--apps/user_status/lib/Db/UserStatusMapper.php1
-rw-r--r--apps/user_status/lib/Service/StatusService.php4
2 files changed, 5 insertions, 0 deletions
diff --git a/apps/user_status/lib/Db/UserStatusMapper.php b/apps/user_status/lib/Db/UserStatusMapper.php
index dc54789d343..50b582bcacd 100644
--- a/apps/user_status/lib/Db/UserStatusMapper.php
+++ b/apps/user_status/lib/Db/UserStatusMapper.php
@@ -137,6 +137,7 @@ class UserStatusMapper extends QBMapper {
->set('is_user_defined', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL))
->set('status_timestamp', $qb->createNamedParameter($now, IQueryBuilder::PARAM_INT))
->where($qb->expr()->lte('status_timestamp', $qb->createNamedParameter($olderThan, IQueryBuilder::PARAM_INT)))
+ ->andWhere($qb->expr()->neq('status', $qb->createNamedParameter(IUserStatus::OFFLINE)))
->andWhere($qb->expr()->orX(
$qb->expr()->eq('is_user_defined', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL), IQueryBuilder::PARAM_BOOL),
$qb->expr()->eq('status', $qb->createNamedParameter(IUserStatus::ONLINE))
diff --git a/apps/user_status/lib/Service/StatusService.php b/apps/user_status/lib/Service/StatusService.php
index 39edad35850..1545e3da4f0 100644
--- a/apps/user_status/lib/Service/StatusService.php
+++ b/apps/user_status/lib/Service/StatusService.php
@@ -355,6 +355,10 @@ class StatusService {
* @param UserStatus $status
*/
private function cleanStatus(UserStatus $status): void {
+ if ($status->getStatus() === IUserStatus::OFFLINE && !$status->getIsUserDefined()) {
+ return;
+ }
+
$status->setStatus(IUserStatus::OFFLINE);
$status->setStatusTimestamp($this->timeFactory->getTime());
$status->setIsUserDefined(false);