diff options
author | Joas Schilling <coding@schilljs.com> | 2021-06-04 12:03:16 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-06-07 09:32:00 +0200 |
commit | 55c44580c26aed3185f10eec5e943b8e82166d04 (patch) | |
tree | 2219edefe0bbd65b5829c334b088484132af579e /apps/user_status/lib | |
parent | 46dbc8fa988176e4a431cafcbae6674fb613c899 (diff) | |
download | nextcloud-server-55c44580c26aed3185f10eec5e943b8e82166d04.tar.gz nextcloud-server-55c44580c26aed3185f10eec5e943b8e82166d04.zip |
Don't update statuses to offline again and again
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/user_status/lib')
-rw-r--r-- | apps/user_status/lib/Db/UserStatusMapper.php | 1 | ||||
-rw-r--r-- | apps/user_status/lib/Service/StatusService.php | 4 |
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); |