Can't remove "Project" column on custom query
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
- 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
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.
#2 Updated by Jean-Baptiste Barth almost 8 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).
#8 Updated by Etienne Massip almost 8 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
/issuesif you remove the Project column from the list since :
namesmethod argument will match the default column list
:column_namesattribute will be set to nil
#has_default_columns?will return true
#columnswill return default column list and project column
Will look for a fix later.
#10 Updated by Etienne Massip almost 8 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
# 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.