fix feature test - needs reviewing and refactoring

pull/10279/head
Christophe Bliard 3 years ago
parent 080a4686bc
commit 75594c043b
No known key found for this signature in database
GPG Key ID: 2BC07603210C3FA4
  1. 18
      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

Loading…
Cancel
Save