Skip to content

Commit

Permalink
fix(Views): allow to sort for meta columns
Browse files Browse the repository at this point in the history
- also fixes a return value that otherwise may render shared views
  ontentless

Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz committed Jan 6, 2025
1 parent 9a72ce9 commit 01cfe8d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/Service/ViewService.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,17 @@ 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 ($sortRule) use ($view): array {
$columnsArray = $view->getColumnsArray();
if (isset($sortRule['columnId']) && $columnsArray && in_array($sortRule['columnId'], $columnsArray, true)) {
if (isset($sortRule['columnId'])
&& $sortRule['columnId'] >= 0 // meta columns can be exposed
&& $columnsArray
&& 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 01cfe8d

Please sign in to comment.