Defect #8411

Can't remove "Project" column on custom query

Added by Simon Edwards over 6 years ago. Updated about 6 years ago.

Status:ClosedStart date:2011-05-20
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:Issues
Target version:1.2.2
Resolution:Fixed Affected version:1.2.0

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:

  1. Go to /issues
  2. Click "Clear" to make sure you're looking at the default view
  3. Click "Options"
  4. Remove the "Project" column from the right-hand box
  5. 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.

default_columns.patch Magnifier - v2 (1.86 KB) Etienne Massip, 2011-06-22 17:23

query_default_columns.patch Magnifier - v3 (1.44 KB) Etienne Massip, 2011-07-12 19:26

Associated revisions

Revision 6099
Added by Jean-Baptiste Barth over 6 years ago

Added a test to ensure 'Project' column can be removed on issues list (#8411)

Revision 7538
Added by Etienne Massip about 6 years ago

Allow project column to be removed from the global issue list columns (#8411).

Revision 7539
Added by Etienne Massip about 6 years ago

Merged r7538 from trunk (#8411).

History

#1 Updated by Etienne Massip over 6 years ago

  • Target version set to Candidate for next minor release

Confirmed.

#2 Updated by Jean-Baptiste Barth over 6 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).

#3 Updated by Etienne Massip over 6 years ago

  • Status changed from Closed to Reopened

Nope, I confirmed I saw it on 1.2 trunk, will test again.

#4 Updated by Jean-Baptiste Barth over 6 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...

#5 Updated by Etienne Massip over 6 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.

#6 Updated by Etienne Massip over 6 years ago

  • Resolution deleted (Fixed)

#7 Updated by Etienne Massip over 6 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

#8 Updated by Etienne Massip over 6 years ago

Still not ran the test (will do !) but find the bug at source:trunk/app/models/query.rb#L347 :

# Set column_names to nil if default columns
if names.map(&:to_s) == Setting.issue_list_default_columns
  names = nil
end
The test is incomplete for /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.

#9 Updated by Etienne Massip over 6 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.

#10 Updated by Etienne Massip over 6 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.

#11 Updated by Etienne Massip over 6 years ago

Updated patch

#12 Updated by Etienne Massip over 6 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.

#13 Updated by Etienne Massip over 6 years ago

This patch still has some glitches, will update it later.

#14 Updated by Etienne Massip over 6 years ago

  • File deleted (default_columns.patch)

#15 Updated by Jean-Philippe Lang over 6 years ago

  • Target version changed from 1.2.1 to Candidate for next minor release

#16 Updated by Etienne Massip over 6 years ago

Last one, simplier is better. Got some issues with my env, so couldn't run tests :/

#17 Updated by Etienne Massip about 6 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.

#18 Updated by Etienne Massip about 6 years ago

  • Resolution set to Fixed

#19 Updated by Mischa The Evil about 6 years ago

Etienne Massip wrote:

Should be fixed with r7538.

Confirmed!

#20 Updated by Jean-Philippe Lang about 6 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF