Test fixes for view search

This commit is contained in:
Dean 2024-09-10 12:19:41 +01:00
parent fac39b2ede
commit f9e8689ce9
2 changed files with 6 additions and 2 deletions

View File

@ -36,7 +36,7 @@ export async function searchView(
// Enrich saved query with ephemeral query params. // Enrich saved query with ephemeral query params.
// We prevent searching on any fields that are saved as part of the query, as // We prevent searching on any fields that are saved as part of the query, as
// that could let users find rows they should not be allowed to access. // that could let users find rows they should not be allowed to access.
let query: any = dataFilters.buildQuery(view.query ?? []) let query: any = dataFilters.buildQuery(view.query)
if (body.query) { if (body.query) {
// Delete extraneous search params that cannot be overridden // Delete extraneous search params that cannot be overridden
delete body.query.onEmptyFilter delete body.query.onEmptyFilter

View File

@ -428,7 +428,11 @@ const builderFilter = (expression: SearchFilter) => {
return query return query
} }
export const buildQuery = (filter: SearchFilterGroup | SearchFilter[]) => { export const buildQuery = (filter?: SearchFilterGroup | SearchFilter[]) => {
if (!filter) {
return
}
const parsedFilter = processSearchFilters(filter) const parsedFilter = processSearchFilters(filter)
if (!parsedFilter) { if (!parsedFilter) {