From 0fb150fa1054ac1ae205ff41285516311f3b3a49 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Thu, 23 Nov 2023 13:12:02 +0100 Subject: [PATCH] Add redmine patch to fix custom field filter group names --- roles/redmine/defaults/main.yml | 3 +++ .../patches/query_filter_group_fix.patch | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 roles/redmine/files/patches/query_filter_group_fix.patch diff --git a/roles/redmine/defaults/main.yml b/roles/redmine/defaults/main.yml index a998fca..4e2c59e 100644 --- a/roles/redmine/defaults/main.yml +++ b/roles/redmine/defaults/main.yml @@ -247,6 +247,8 @@ redmine_patches: # strip: 1 - file: allowed_to_condition strip: 1 + - file: query_filter_group_fix + strip: 1 # set to yes, if git history for ssh is required on deploy redmine_full_remote_deploy: false @@ -264,6 +266,7 @@ redmine_write_permission_dirs: # for additional_tags hint file - path: /plugins +# https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/AsyncAdapter.html # redmine_queue_adapter: async redmine_async_queue_min_threads: 1 diff --git a/roles/redmine/files/patches/query_filter_group_fix.patch b/roles/redmine/files/patches/query_filter_group_fix.patch new file mode 100644 index 0000000..078a993 --- /dev/null +++ b/roles/redmine/files/patches/query_filter_group_fix.patch @@ -0,0 +1,23 @@ +diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb +index b90f86457..d2505ff6f 100644 +--- a/app/helpers/queries_helper.rb ++++ b/app/helpers/queries_helper.rb +@@ -26,15 +26,15 @@ module QueriesHelper + ungrouped = [] + grouped = {label_string: [], label_date: [], label_time_tracking: [], label_attachment: []} + query.available_filters.map do |field, field_options| +- if field =~ /^(.+)\./ ++ if /^cf_\d+\./.match?(field) ++ group = (field_options[:through] || field_options[:field]).try(:name) ++ elsif field =~ /^(.+)\./ + # association filters + group = "field_#{$1}".to_sym + elsif field_options[:type] == :relation + group = :label_relations + elsif field_options[:type] == :tree + group = query.is_a?(IssueQuery) ? :label_relations : nil +- elsif /^cf_\d+\./.match?(field) +- group = (field_options[:through] || field_options[:field]).try(:name) + elsif %w(member_of_group assigned_to_role).include?(field) + group = :field_assigned_to + elsif field_options[:type] == :date_past || field_options[:type] == :date