Project

General

Profile

Actions

Defect #17881

closed

Javascript error when displaying a saved query with some defined filters omitted from the available_filters

Added by Holger Just over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

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

Actions #1

Updated by Jan from Planio www.plan.io over 10 years ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Baptiste Barth
  • Target version set to Candidate for next minor release

Here's another fresh and easy one, Jean-Baptiste, if you like.

Actions #2

Updated by Jean-Baptiste Barth over 10 years ago

No problem merging that, seems reasonable, but I don't reproduce the problem on my 2.5.2 instance. Say I have a project with id 1, I define a query on the cross-projects issue page with a condition on project_id = 1. When I go to the project (or an other one), the "addFilter" line is present for sure, but it doesn't break and looks like valid JS. Am I missing something ?

I'd just like to understand the problem and the conditions in which it occurs. And maybe write a tiny test as a documentation for the future.

Thanks!

Actions #3

Updated by Holger Just over 10 years ago

After some deeper investigation, it turns out, that this is a duplicate of #15190 and thus already fixed in Redmine. I guess, we can close this issue...

Actions #4

Updated by Jan from Planio www.plan.io over 10 years ago

  • Tracker changed from Patch to Defect
  • Status changed from Resolved to Closed
  • Target version deleted (Candidate for next minor release)
  • Resolution set to Duplicate

sorry for the fuss...

Actions

Also available in: Atom PDF