mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Do the filtering on the DB instead
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
parent
cfdca11ad9
commit
8c95e46744
2 changed files with 10 additions and 6 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue