From bb1f09e9c5f53cbf83c34875e3e03b66698bf632 Mon Sep 17 00:00:00 2001 From: Wieland Lindenthal Date: Mon, 17 Dec 2018 17:13:13 +0100 Subject: [PATCH] Fix filter_configuration to always the `list` array --- .../work_packages/filter/search_filter.rb | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/app/models/queries/work_packages/filter/search_filter.rb b/app/models/queries/work_packages/filter/search_filter.rb index f83f543a72..5fcca6393f 100644 --- a/app/models/queries/work_packages/filter/search_filter.rb +++ b/app/models/queries/work_packages/filter/search_filter.rb @@ -36,24 +36,34 @@ class Queries::WorkPackages::Filter::SearchFilter < CONTAINS_OPERATOR = '~'.freeze CE_FILTERS = [ - Queries::WorkPackages::Filter::FilterConfiguration.new(Queries::WorkPackages::Filter::SubjectFilter, - :subject, - CONTAINS_OPERATOR), - Queries::WorkPackages::Filter::FilterConfiguration.new(Queries::WorkPackages::Filter::DescriptionFilter, - :subject, - CONTAINS_OPERATOR), - Queries::WorkPackages::Filter::FilterConfiguration.new(Queries::WorkPackages::Filter::CommentFilter, - :subject, - CONTAINS_OPERATOR), + Queries::WorkPackages::Filter::FilterConfiguration.new( + Queries::WorkPackages::Filter::SubjectFilter, + :subject, + CONTAINS_OPERATOR + ), + Queries::WorkPackages::Filter::FilterConfiguration.new( + Queries::WorkPackages::Filter::DescriptionFilter, + :subject, + CONTAINS_OPERATOR + ), + Queries::WorkPackages::Filter::FilterConfiguration.new( + Queries::WorkPackages::Filter::CommentFilter, + :subject, + CONTAINS_OPERATOR + ) ].freeze EE_TSV_FILTERS = [ - Queries::WorkPackages::Filter::FilterConfiguration.new(Queries::WorkPackages::Filter::AttachmentContentFilter, - :subject, - CONTAINS_OPERATOR), - Queries::WorkPackages::Filter::FilterConfiguration.new(Queries::WorkPackages::Filter::AttachmentFileNameFilter, - :subject, - CONTAINS_OPERATOR) + Queries::WorkPackages::Filter::FilterConfiguration.new( + Queries::WorkPackages::Filter::AttachmentContentFilter, + :subject, + CONTAINS_OPERATOR + ), + Queries::WorkPackages::Filter::FilterConfiguration.new( + Queries::WorkPackages::Filter::AttachmentFileNameFilter, + :subject, + CONTAINS_OPERATOR + ) ].freeze def self.key @@ -74,6 +84,7 @@ class Queries::WorkPackages::Filter::SearchFilter < def filter_configurations list = CE_FILTERS - list + EE_TSV_FILTERS if EnterpriseToken.allows_to?(:attachment_filters) && OpenProject::Database.allows_tsv? + list += EE_TSV_FILTERS if EnterpriseToken.allows_to?(:attachment_filters) && OpenProject::Database.allows_tsv? + list end end