Defect #32503

Project jump box options are not extracted correctly after searching

Added by Mizuki ISHIKAWA 3 months ago. Updated 3 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Projects
Target version:-
Resolution:Fixed Affected version:

Description

Reproduction procedure:
  • Step1. Check the options for Project jump box
  • Step2. Search by entering keywords on https://redmine_url/search
  • Step3. Check the options for Project jump box. You should see different options than when you checked in step1.

Cause:
Both the search keyword input field of the search page and the project jump box input field are elements with name q.

Project jumpbox options are narrowed down based on params[:q]. ( http://www.redmine.org/projects/redmine/repository/entry/trunk/app/helpers/application_helper.rb#L475 )

    bookmarked = jump_box.bookmarked_projects(params[:q])
    recents = jump_box.recently_used_projects(params[:q])
    projects = projects - (recents + bookmarked)

The params[:q] received from the search keyword input field is mistaken for the params[:q] received from the project jump box input field, and the keyword(params[:q]) will narrow down the project jump box options.

related to #31355

example.gif (462 KB) Mizuki ISHIKAWA, 2019-11-22 06:28


Related issues

Related to Redmine - Feature #31355: Bookmarks and recently used projects for the project jump... Closed

Associated revisions

Revision 19325
Added by Go MAEDA 3 months ago

Fix that bookmarked and recently used projects are unexpectedly filtered by a search keyword after full-text search (#31355, #32503).

Patch by Mizuki ISHIKAWA.

Revision 19326
Added by Go MAEDA 3 months ago

Merged r19325 from trunk to 4.1-stable (#31355, #32503).

History

#1 Updated by Mizuki ISHIKAWA 3 months ago

I attach a screen gif that reproduces the problem.

#2 Updated by Mizuki ISHIKAWA 3 months ago

The following minor changes will fix this issue.

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ab4849957..b76ade5d8 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -477,8 +477,9 @@ module ApplicationHelper

   def render_projects_for_jump_box(projects, selected=nil)
     jump_box = Redmine::ProjectJumpBox.new User.current
-    bookmarked = jump_box.bookmarked_projects(params[:q])
-    recents = jump_box.recently_used_projects(params[:q])
+    query = params[:q] if request.format.js?
+    bookmarked = jump_box.bookmarked_projects(query)
+    recents = jump_box.recently_used_projects(query)
     projects = projects - (recents + bookmarked)
     projects_label = (bookmarked.any? || recents.any?) ? :label_optgroup_others : :label_project_plural
     jump = params[:jump].presence || current_menu_item

#3 Updated by Go MAEDA 3 months ago

Confirmed the issue is reproducible and the patch in #32503#note-2 fixes it.

#4 Updated by Go MAEDA 3 months ago

  • Related to Feature #31355: Bookmarks and recently used projects for the project jump box added

#5 Updated by Go MAEDA 3 months ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Committed the patch in #32503#note-2 as a part of #31355. Thank you for catching and fixing it before the release of 4.1.0.

Also available in: Atom PDF