Skip to content

Commit

Permalink
Merge pull request #1525 from nextcloud/fix/1524/sort-views-hide-not-…
Browse files Browse the repository at this point in the history
…null

fix(Views): allow to sort for meta columns
  • Loading branch information
blizzz authored Jan 9, 2025
2 parents 385951f + faa22c4 commit 467c8d7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Service/ViewService.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,18 @@ private function enhanceView(View $view, string $userId): void {
$rawSortArray = $view->getSortArray();
if ($rawSortArray) {
$view->setSortArray(
array_map(static function ($sortRule) use ($view) {
array_map(static function (array $sortRule) use ($view): array {
$columnsArray = $view->getColumnsArray();
if (isset($sortRule['columnId']) && $columnsArray && in_array($sortRule['columnId'], $columnsArray, true)) {
if (isset($sortRule['columnId'])
&& (
Column::isValidMetaTypeId($sortRule['columnId'])
|| in_array($sortRule['columnId'], $columnsArray, true)
)
) {
return $sortRule;
}
// Instead of sort rule just indicate that there is a rule, but hide details
return null;
return [];
},
$rawSortArray));
}
Expand Down

0 comments on commit 467c8d7

Please sign in to comment.