Defect #17881
closedJavascript error when displaying a saved query with some defined filters omitted from the available_filters
0%
Description
Attached to this issue, there is a fix for an issue that can occur if a users defines a query in another scope than where it is ultimately displayed. If the query define a filter which is not available in the current scope, rendering the filters form will throw a Javascript error resulting in a halt of Javascript execution on the respective page.
In our case at Planio, we had a query that was defined on all projects. The query had a filter of project_id
. Now, the project_id
is only valid outside of a project. If the query is run inside of a project, the project_id
filter will not be added to the available_filters
. However, the defined filter is still attempted to be rendered, as the view just loops over all defined filters in the query. This results in a javascript error as during rendering in the browser, the filter can not be added as it is not included in available filters.
The attached patch fixes this issue. It ensures that only those filters are attempted to be rendered that are actually available in the current scope. This fixes the Javascript error.
Files