Skip to content

Commit

Permalink
[Forum] adds default sort on subject titles
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Feb 28, 2023
1 parent 9b629ef commit afb5846
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/plugin/forum/Finder/SubjectFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public function configureQueryBuilder(QueryBuilder $qb, array $searches = [], ar
// manages custom sort properties
if (!empty($sortBy)) {
switch ($sortBy['property']) {
case 'sticked':
$qb->addOrderBy('obj.sticked', 1 === $sortBy['direction'] ? 'ASC' : 'DESC');
$qb->addOrderBy('obj.title', 'ASC');
break;
case 'meta.messages':
$qb->select('obj, count(msg) AS HIDDEN countMsg');
$qb->leftJoin('obj.messages', 'msg');
Expand Down

0 comments on commit afb5846

Please sign in to comment.