Defect #8411
closedCan't remove "Project" column on custom query
100%
Description
If I create a custom query for issues, and remove the "Project" column from display (for example, if I'm using it as a "Group By" instead), it returns as soon as I apply or save the query.
This appears to be because this is considered to be the "default columns" - if you do this with a saved query, after saving the query, the "Default columns" checkbox is ticked when you go back and edit it.
One solution is to add another column, or change the order, but it's not obvious - a couple of users have tried to create the exact same query and got this result.
It appears to affect all versions but I'm running 1.1.2
To reproduce:
- Go to /issues
- Click "Clear" to make sure you're looking at the default view
- Click "Options"
- Remove the "Project" column from the right-hand box
- Click apply - the column is not removed
To work-around:
Repeat steps 1-4, but then move one of the displayed columns up or down before clicking apply.
I couldn't find any similar reports, but I realise that this may be a duplicate. Also, I'm not sure "Issues" is the correct category.
Files
Updated by Etienne Massip over 13 years ago
- Target version set to Candidate for next minor release
Confirmed.
Updated by Jean-Baptiste Barth over 13 years ago
- Status changed from New to Closed
- Target version changed from Candidate for next minor release to 1.2.1
- % Done changed from 0 to 100
- Resolution set to Fixed
Doesn't seem to occur anymore, tested on current trunk and on 1.2.0-stable. I presume it's fixed because now filters, sort options and columns are kept in the URL. Anyway I completed the tests in r6099 to be sure it doesn't happen again. Thanks for reporting (and confirming).
Updated by Etienne Massip over 13 years ago
- Status changed from Closed to Reopened
Nope, I confirmed I saw it on 1.2 trunk, will test again.
Updated by Jean-Baptiste Barth over 13 years ago
Ok, if you manage to reproduce, can you run the test and tell me if it's relevant ? Maybe it's more complicated...
Updated by Etienne Massip over 13 years ago
Just reproduced on demo site which runs on 1.2.0 following the above instructions step by step, did you try with /issues or /projectX/issues ?
Did not take time to run the test, will try to do it tomorrow.
Updated by Etienne Massip over 13 years ago
- Affected version (unused) changed from 1.1.2 to 1.2.0
- Affected version changed from 1.1.2 to 1.2.0
Updated by Etienne Massip over 13 years ago
Still not ran the test (will do !) but find the bug at source:trunk/app/models/query.rb#L347 :
The test is incomplete for# Set column_names to nil if default columns if names.map(&:to_s) == Setting.issue_list_default_columns names = nil end
/issues
if you remove the Project column from the list since :
- the
names
method argument will match the default column list :column_names
attribute will be set to nil#has_default_columns?
will return true#columns
will return default column list and project column
Will look for a fix later.
Updated by Etienne Massip over 13 years ago
- File default_columns.patch added
Here's a patch.
I didn't test it in all situations, didn't run the test suite neither.
Also, I guess there's room for nicer code in #default_column
.
Updated by Etienne Massip over 13 years ago
E.g., replacing :
column_index = available_columns.index(column)
# Adds the project column by default for cross-project lists
if project.nil? && !project_column_included && column_index > project_column_index
by :
# Adds the project column by default for cross-project lists
if project.nil? && !project_column_included && available_columns.index(column) > project_column_index
would perform faster.
Updated by Etienne Massip over 13 years ago
- File default_columns.patch default_columns.patch added
Updated patch
Updated by Etienne Massip over 13 years ago
And your test pass since the specified columns are ['tracker', 'subject', 'assigned_to'].
It should not pass with columns = Setting.issue_list_default_columns
at start of the test.
Updated by Etienne Massip over 13 years ago
This patch still has some glitches, will update it later.
Updated by Etienne Massip over 13 years ago
- File deleted (
default_columns.patch)
Updated by Jean-Philippe Lang over 13 years ago
- Target version changed from 1.2.1 to Candidate for next minor release
Updated by Etienne Massip over 13 years ago
Last one, simplier is better. Got some issues with my env, so couldn't run tests :/
Updated by Etienne Massip about 13 years ago
- Status changed from Reopened to Resolved
- Target version changed from Candidate for next minor release to 1.2.2
Should be fixed with r7538.
Updated by Mischa The Evil about 13 years ago
Updated by Jean-Philippe Lang about 13 years ago
- Status changed from Resolved to Closed