Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Do not highlight the "all open" query when simply navigating through the menu

Henriette Darge414101c3a0d3
diff --git a/app/controllers/work_packages/menus_controller.rb b/app/controllers/work_packages/menus_controller.rb
index 7c5061c9513..f05a98d8160 100644
--- a/app/controllers/work_packages/menus_controller.rb
+++ b/app/controllers/work_packages/menus_controller.rb
@@ -30,7 +30,7 @@ module WorkPackages
before_action :load_and_authorize_in_optional_project
def show
- @sidebar_menu_items = WorkPackages::Menu.new(project: @project, params:).menu_items
+ @sidebar_menu_items = WorkPackages::Menu.new(project: @project, params:, request:).menu_items
render layout: nil
end
end
diff --git a/app/menus/work_packages/menu.rb b/app/menus/work_packages/menu.rb
index 64ae6cbcc31..d4c4b3628e6 100644
--- a/app/menus/work_packages/menu.rb
+++ b/app/menus/work_packages/menu.rb
@@ -29,8 +29,9 @@ module WorkPackages
class Menu < Submenu
attr_reader :view_type, :project, :params
- def initialize(project: nil, params: nil)
+ def initialize(project: nil, params: nil, request: nil)
@view_type = "work_packages_table"
+ @request = request
super(view_type:, project:, params:)
end
@@ -64,10 +65,13 @@ module WorkPackages
end
def selected?(query_params)
- # Special rules, as those are redirected to completely new pages where only the name parameter is preserved
- return true if query_params[:name] == :summary && params[:name] == "summary"
- return true if query_params[:name] == :shared_with_me && params[:name] == "shared_with_me"
- return true if query_params[:name] == :shared_with_users && params[:name] == "shared_with_users"
+ return true if check_for_redirected_urls(query_params)
+
+ if query_params[:work_package_default] &&
+ (%i[filters query_props query_id name].none? { |k| params.key? k }) &&
+ @request.referer.include?("work_packages")
+ return true
+ end
super
end
@@ -75,5 +79,13 @@ module WorkPackages
def ee_upsale_path(query_params)
share_upsale_work_packages_path({ name: query_params[:name] })
end
+
+ def check_for_redirected_urls(query_params)
+ # Special rules, as those are redirected to completely new pages where only the name parameter is preserved
+ return true if query_params[:name] == :shared_with_me && params[:name] == "shared_with_me"
+ return true if query_params[:name] == :shared_with_users && params[:name] == "shared_with_users"
+
+ true if query_params[:name] == :summary && params[:name] == "summary"
+ end
end
end
diff --git a/app/services/work_packages/default_query_generator_service.rb b/app/services/work_packages/default_query_generator_service.rb
index 0a86b78cc25..0db02e7e77d 100644
--- a/app/services/work_packages/default_query_generator_service.rb
+++ b/app/services/work_packages/default_query_generator_service.rb
@@ -55,7 +55,7 @@ module ::WorkPackages
end
def call(query_key: DEFAULT_QUERY)
- return {} if query_key == DEFAULT_QUERY
+ return { work_package_default: true } if query_key == DEFAULT_QUERY
params = self.class.assign_params(query_key, project)
@@ -65,10 +65,6 @@ module ::WorkPackages
end
class << self
- def all_open_query
- {}
- end
-
def latest_activity_query
DEFAULT_PARAMS.merge(
{
@@ -144,8 +140,6 @@ module ::WorkPackages
def assign_params(query_key, project)
case query_key
- when DEFAULT_QUERY
- all_open_query
when :latest_activity
latest_activity_query
when :recently_created