Project

General

Profile

Actions

Defect #8411

closed

Can't remove "Project" column on custom query

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

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
Start date:
2011-05-20
Due date:
% Done:

100%

Estimated time:
Resolution:
Fixed
Affected version:

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.


Files

default_columns.patch (1.86 KB) default_columns.patch v2 Etienne Massip, 2011-06-22 17:23
query_default_columns.patch (1.44 KB) query_default_columns.patch v3 Etienne Massip, 2011-07-12 19:26
Actions #1

Updated by Etienne Massip over 13 years ago

  • Target version set to Candidate for next minor release

Confirmed.

Actions #2

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).

Actions #3

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.

Actions #4

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...

Actions #5

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.

Actions #6

Updated by Etienne Massip over 13 years ago

  • Resolution deleted (Fixed)
Actions #7

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
Actions #8

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 :

# 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.

Actions #9

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.

Actions #10

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.

Actions #11

Updated by Etienne Massip over 13 years ago

Updated patch

Actions #12

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.

Actions #13

Updated by Etienne Massip over 13 years ago

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

Actions #14

Updated by Etienne Massip over 13 years ago

  • File deleted (default_columns.patch)
Actions #15

Updated by Jean-Philippe Lang over 13 years ago

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

Updated by Etienne Massip over 13 years ago

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

Actions #17

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.

Actions #18

Updated by Etienne Massip about 13 years ago

  • Resolution set to Fixed
Actions #19

Updated by Mischa The Evil about 13 years ago

Etienne Massip wrote:

Should be fixed with r7538.

Confirmed!

Actions #20

Updated by Jean-Philippe Lang about 13 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF