Defect #33083

Projects filter "Subproject of" does not work when the given value is "My projects" or "My bookmarks"

Added by Mizuki ISHIKAWA about 1 month ago. Updated 26 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Projects
Target version:4.1.1
Resolution:Fixed Affected version:4.1.0

Description

Reproduction steps:
  • Use PostgreSQL
  • View projects/index
  • Add "Subproject of" filter
  • Set the operator of the "Subproject of" filter to "is" or "is not"
  • Set the value of the "Subproject of" filter to << my projects >> or << my bookmarks >>
  • Apply => An exception occurs

Error message:

ActiveRecord::StatementInvalid (PG::InvalidTextRepresentation: ERROR:  invalid input syntax for integer: "mine" 
LINE 1: ...rojects.status <> 9) AND ((projects.parent_id IN ('mine'))) ...
                                                             ^
: SELECT "projects".* FROM "projects" WHERE (projects.status <> 9) AND ((projects.parent_id IN ('mine'))) ORDER BY projects.lft ASC):

app/controllers/projects_controller.rb:57:in `block (2 levels) in index'
app/controllers/projects_controller.rb:53:in `index'
lib/redmine/sudo_mode.rb:64:in `sudo_mode'

Executing the SELECT statement without converting << my projects >>('mine') and << my bookmarks >>('bookmarks') to actual ids is the cause of this problem.

projects.png (37.4 KB) Mizuki ISHIKAWA, 2020-03-03 08:57

fix-33083.patch Magnifier (2.03 KB) Mizuki ISHIKAWA, 2020-03-03 09:00


Related issues

Related to Redmine - Feature #29482: Query system for Projects page Closed

Associated revisions

Revision 19559
Added by Go MAEDA 29 days ago

Projects filter "Subproject of" does not work when the given value is "My projects" or "My bookmarks" (#33083).

Patch by Mizuki ISHIKAWA.

Revision 19560
Added by Go MAEDA 29 days ago

Merged r19559 from trunk to 4.1-stable (#33083).

Revision 19563
Added by Go MAEDA 27 days ago

Fix a RuboCop offense Style/MultipleComparison (#33083).

Revision 19564
Added by Go MAEDA 26 days ago

Merged r19563 from trunk to 4.1-stable (#33083).

History

#1 Updated by Mizuki ISHIKAWA about 1 month ago

I have attached a patch to fix this problem.

#2 Updated by Go MAEDA about 1 month ago

#3 Updated by Go MAEDA about 1 month ago

  • Status changed from New to Confirmed
  • Affected version set to 4.1.0

#4 Updated by Marius BALTEANU about 1 month ago

  • Target version set to 4.1.1

Looks good to me.

#5 Updated by Go MAEDA 29 days ago

  • Subject changed from Filtering the parent_id field in Project by "My projects" or "My bookmarks" raises an exception to Projects filter "Subproject of" does not work when the given value is "My projects" or "My bookmarks"
  • Status changed from Confirmed to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix. Thank you for catching and fixing the issue.

#6 Updated by Go MAEDA 29 days ago

  • Status changed from Resolved to Closed
  • Assignee deleted (Go MAEDA)
  • Resolution deleted (Fixed)

#7 Updated by Go MAEDA 26 days ago

  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Also available in: Atom PDF