Skip to content

Commit

Permalink
fixup! fix(View): column might be saved as null
Browse files Browse the repository at this point in the history
  • Loading branch information
blizzz committed Jul 12, 2024
1 parent 42697c6 commit 36beef5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 0 additions & 6 deletions lib/Db/Row2Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,6 @@ private function getFilterGroups(IQueryBuilder &$qb, array $filters): array {
private function getFilter(IQueryBuilder &$qb, array $filterGroup): array {
$filterExpressions = [];
foreach ($filterGroup as $filter) {
if ($filter['columnId'] === null) {
// a filter(group) was stored with a not-selected column. Skip,
// otherwise it breaks impressively.
continue;
}

$columnId = $filter['columnId'];
// Fail if the filter is for a column that is not in the list and no meta column
if (!isset($this->columns[$columnId]) && !isset($this->allColumns[$columnId]) && $columnId > 0) {
Expand Down
12 changes: 11 additions & 1 deletion lib/Db/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,17 @@ public function getSortArray(): array {
* @return list<list<array{columnId: int, operator: 'begins-with'|'ends-with'|'contains'|'is-equal'|'is-greater-than'|'is-greater-than-or-equal'|'is-lower-than'|'is-lower-than-or-equal'|'is-empty', value: string|int|float}>>
*/
public function getFilterArray():array {
return $this->getArray($this->getFilter());
$filters = $this->getArray($this->getFilter());
// a filter(group) was stored with a not-selected column - it may break impressively.
// filter them out now until we have a permanent fix
foreach ($filters as &$filterGroups) {
$filterGroups = array_filter($filterGroups, function (array $item) {
return $item['columnId'] !== null;
});
}
return array_filter($filters, function (array $item) {
return !empty($item);
});
}

private function getArray(?string $json): array {
Expand Down

0 comments on commit 36beef5

Please sign in to comment.