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

restructure code

ulfertsc08af4445b5a
diff --git a/app/models/queries/work_packages/filter/search_filter.rb b/app/models/queries/work_packages/filter/search_filter.rb
index e6108dfb4a0..961a3014441 100644
--- a/app/models/queries/work_packages/filter/search_filter.rb
+++ b/app/models/queries/work_packages/filter/search_filter.rb
@@ -75,19 +75,18 @@ class Queries::WorkPackages::Filter::SearchFilter <
# Does not remove custom fields that are not marked as filters
# as the intend of this filter is to search and it is used in the
# search context. Thus, only the searchable flag is of interest.
- custom_fields =
- if context&.project
- context.project.all_work_package_custom_fields.select do |custom_field|
- %w(text string).include?(custom_field.field_format) &&
- custom_field.searchable == true
- end
- else
- ::WorkPackageCustomField
- .where(field_format: %w(text string),
- searchable: true)
- end
+ custom_fields = if context&.project
+ context
+ .project
+ .all_work_package_custom_fields
+ else
+ ::WorkPackageCustomField
+ end
- custom_fields.map do |custom_field|
+ custom_fields
+ .where(field_format: %w(text string),
+ searchable: true)
+ .map do |custom_field|
Queries::WorkPackages::Filter::FilterConfiguration.new(
Queries::WorkPackages::Filter::CustomFieldFilter,
custom_field.column_name,