Skip to content

Commit

Permalink
Merge pull request #34608 from nextcloud/backport/34569/stable25
Browse files Browse the repository at this point in the history
[stable25] Filter out backup user status (those beginning with _ as userId)
  • Loading branch information
PVince81 authored Oct 14, 2022
2 parents 684bd27 + 25efb43 commit b99e478
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions apps/user_status/lib/Db/UserStatusMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ public function findAllRecent(?int $limit = null, ?int $offset = null): array {
->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($this->db->escapeLikeParameter('_') . '%'))
));

if ($limit !== null) {
$qb->setMaxResults($limit);
Expand Down

0 comments on commit b99e478

Please sign in to comment.