diff options
Diffstat (limited to 'app/graphql/resolvers/ci/catalog/resources_resolver.rb')
-rw-r--r-- | app/graphql/resolvers/ci/catalog/resources_resolver.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/graphql/resolvers/ci/catalog/resources_resolver.rb b/app/graphql/resolvers/ci/catalog/resources_resolver.rb index c6904dcd7f6..ec415cf25c1 100644 --- a/app/graphql/resolvers/ci/catalog/resources_resolver.rb +++ b/app/graphql/resolvers/ci/catalog/resources_resolver.rb @@ -27,17 +27,13 @@ module Resolvers description: 'Project with the namespace catalog.' def resolve_with_lookahead(scope:, project_path: nil, search: nil, sort: nil) - if project_path.present? - project = Project.find_by_full_path(project_path) - - apply_lookahead( - ::Ci::Catalog::Listing - .new(context[:current_user]) - .resources(namespace: project.root_namespace, sort: sort, search: search) - ) - elsif scope == :all - apply_lookahead(::Ci::Catalog::Listing.new(context[:current_user]).resources(sort: sort, search: search)) - end + project = Project.find_by_full_path(project_path) + + apply_lookahead( + ::Ci::Catalog::Listing + .new(context[:current_user]) + .resources(namespace: project&.root_namespace, sort: sort, search: search, scope: scope) + ) end private |