Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-10-13 14:44:37 +0300
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2022-10-14 15:59:03 +0300
commit446bb96ba88494473ef2d08c4d489583329488a9 (patch)
tree74557e77464986b11c0a421b12acb940ecfde517 /apps
parent726d857690c33de79f090444fc120c5518a1f4ff (diff)
Do the filtering on the DB instead
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps')
-rw-r--r--apps/user_status/lib/Dashboard/UserStatusWidget.php3
-rw-r--r--apps/user_status/lib/Db/UserStatusMapper.php13
2 files changed, 10 insertions, 6 deletions
diff --git a/apps/user_status/lib/Dashboard/UserStatusWidget.php b/apps/user_status/lib/Dashboard/UserStatusWidget.php
index 50cca725a55..5a89040dfa5 100644
--- a/apps/user_status/lib/Dashboard/UserStatusWidget.php
+++ b/apps/user_status/lib/Dashboard/UserStatusWidget.php
@@ -152,8 +152,7 @@ class UserStatusWidget implements IAPIWidget, IIconWidget, IOptionWidget {
$this->service->findAllRecentStatusChanges($limit + 1, 0),
static function (UserStatus $status) use ($userId, $since): bool {
return $status->getUserId() !== $userId
- && ($since === null || $status->getStatusTimestamp() > (int) $since)
- && !str_starts_with($status->getUserId(), "_");
+ && ($since === null || $status->getStatusTimestamp() > (int) $since);
}
),
0,
diff --git a/apps/user_status/lib/Db/UserStatusMapper.php b/apps/user_status/lib/Db/UserStatusMapper.php
index 4f48ea46818..cb7ad5392db 100644
--- a/apps/user_status/lib/Db/UserStatusMapper.php
+++ b/apps/user_status/lib/Db/UserStatusMapper.php
@@ -76,10 +76,15 @@ class UserStatusMapper extends QBMapper {
->select('*')
->from($this->tableName)
->orderBy('status_timestamp', 'DESC')
- ->where($qb->expr()->notIn('status', $qb->createNamedParameter([IUserStatus::ONLINE, IUserStatus::AWAY, IUserStatus::OFFLINE], IQueryBuilder::PARAM_STR_ARRAY)))
- ->orWhere($qb->expr()->isNotNull('message_id'))
- ->orWhere($qb->expr()->isNotNull('custom_icon'))
- ->orWhere($qb->expr()->isNotNull('custom_message'));
+ ->where($qb->expr()->andX(
+ $qb->expr()->orX(
+ $qb->expr()->notIn('status', $qb->createNamedParameter([IUserStatus::ONLINE, IUserStatus::AWAY, IUserStatus::OFFLINE], IQueryBuilder::PARAM_STR_ARRAY)),
+ $qb->expr()->isNotNull('message_id'),
+ $qb->expr()->isNotNull('custom_icon'),
+ $qb->expr()->isNotNull('custom_message'),
+ ),
+ $qb->expr()->notLike('user_id', $qb->createNamedParameter('\_%'))
+ ));
if ($limit !== null) {
$qb->setMaxResults($limit);