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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Properly use columns for sorting
Klaus Zandersa01802b0948d
diff --git a/app/components/projects/configure_view_modal_component.rb b/app/components/projects/configure_view_modal_component.rbindex 7fea3b5aa19..71c2ca14107 100644--- a/app/components/projects/configure_view_modal_component.rb+++ b/app/components/projects/configure_view_modal_component.rb@@ -43,9 +43,12 @@ class Projects::ConfigureViewModalComponent < ApplicationComponentdef available_orders@available_orders ||= begin- selects = ::Queries::Register.orders[query.class].map(&:key)- ::Queries::Register.orders[query.class].select do |order|- selects.include?(order.key)+ all_selectable_columns = helpers.projects_columns_options+ all_order_keys = ::Queries::Register.orders[query.class]&.map(&:key)++ # Keys from the order can be symbols, strings or regexes+ all_selectable_columns.select do |column_option|+ all_order_keys.any? { |order_key| order_key === column_option[:id] }endendenddiff --git a/app/components/queries/sort_by_component.rb b/app/components/queries/sort_by_component.rbindex a9258d93b03..0c4655079ab 100644--- a/app/components/queries/sort_by_component.rb+++ b/app/components/queries/sort_by_component.rb@@ -34,7 +34,7 @@ class Queries::SortByComponent < ApplicationComponentdef select_optionsoptions_for_select(- available_orders.map { |order| [order.key, order.key] },+ available_orders.map { |order| [order[:name], order[:id]] },order&.attribute)end