diff options
author | Daniel Rudolf <github.com@daniel-rudolf.de> | 2020-05-21 14:51:50 +0300 |
---|---|---|
committer | Daniel Rudolf <github.com@daniel-rudolf.de> | 2020-05-21 14:51:50 +0300 |
commit | 9c052b4a066fb45644f5c50662f1d7fae0fb6e46 (patch) | |
tree | 0c8c9599cce4ec969443118779e984acca60cca5 /lib/Room.php | |
parent | bbdfc442f2c2401c514c8160fbaf5fd486c3d2c2 (diff) |
Sort results of Manager::searchRoomsByToken() and Room::searchParticipants()
Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
Diffstat (limited to 'lib/Room.php')
-rw-r--r-- | lib/Room.php | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/Room.php b/lib/Room.php index ef0be8f5b..d3e9795af 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -1016,25 +1016,26 @@ class Room { } /** - * @param string $searchUserId + * @param string $search * @param int $limit * @param int $offset * @return Participant[] */ - public function searchParticipants(string $searchUserId = '', int $limit = null, int $offset = null): array { + public function searchParticipants(string $search = '', int $limit = null, int $offset = null): array { $query = $this->db->getQueryBuilder(); $query->select('*') ->from('talk_participants') ->where($query->expr()->eq('room_id', $query->createNamedParameter($this->getId()))); - if ($searchUserId !== '') { + if ($search !== '') { $query->where($query->expr()->iLike('user_id', $query->createNamedParameter( - '%' . $this->db->escapeLikeParameter($searchUserId) . '%' + '%' . $this->db->escapeLikeParameter($search) . '%' ))); } $query->setMaxResults($limit) - ->setFirstResult($offset); + ->setFirstResult($offset) + ->orderBy('user_id', 'ASC'); $result = $query->execute(); $participants = []; @@ -1043,10 +1044,6 @@ class Room { } $result->closeCursor(); - uasort($participants, function (Participant $a, Participant $b) { - return strcasecmp($a->getUser(), $b->getUser()); - }); - return $participants; } |