From 75594c043b96f411b448f172245a00565a48a95f Mon Sep 17 00:00:00 2001 From: Christophe Bliard Date: Wed, 2 Mar 2022 17:52:45 +0100 Subject: [PATCH] fix feature test - needs reviewing and refactoring --- .../schemas/query_schema_representer.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/api/v3/queries/schemas/query_schema_representer.rb b/lib/api/v3/queries/schemas/query_schema_representer.rb index 1849f0fbb5..abe2d6c630 100644 --- a/lib/api/v3/queries/schemas/query_schema_representer.rb +++ b/lib/api/v3/queries/schemas/query_schema_representer.rb @@ -263,7 +263,9 @@ module API end def filters_schemas - filters = represented.available_filters + filters = represented + .available_filters + .reject { excluded_filter?(_1) } QueryFilterInstanceSchemaCollectionRepresenter.new(filters, self_link: filter_instance_schemas_href, form_embedded: form_embedded, @@ -277,6 +279,20 @@ module API api_v3_paths.query_filter_instance_schemas end end + + private + + # ToDo: fix duplication with @excluded_filters in lib/api/v3/queries/schemas/filter_dependency_representer_factory.rb + def excluded_filter?(filter) + [ + ::Queries::Storages::WorkPackages::Filter::FileLinkOriginIdFilter, + ::Queries::Storages::WorkPackages::Filter::LinkableToStorageIdFilter, + ::Queries::Storages::WorkPackages::Filter::LinkableToStorageUrlFilter, + ::Queries::Storages::WorkPackages::Filter::StorageIdFilter, + ::Queries::Storages::WorkPackages::Filter::StorageUrlFilter, + ::Queries::WorkPackages::Filter::RelatableFilter + ].any? { filter.is_a?(_1) } + end end end end