diff options
Diffstat (limited to 'app/graphql/resolvers/design_management/versions_resolver.rb')
-rw-r--r-- | app/graphql/resolvers/design_management/versions_resolver.rb | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/app/graphql/resolvers/design_management/versions_resolver.rb b/app/graphql/resolvers/design_management/versions_resolver.rb index 23ba3c86d98..de636655087 100644 --- a/app/graphql/resolvers/design_management/versions_resolver.rb +++ b/app/graphql/resolvers/design_management/versions_resolver.rb @@ -9,8 +9,6 @@ module Resolvers VersionID = ::Types::GlobalIDType[::DesignManagement::Version] - extras [:parent] - argument :earlier_or_equal_to_sha, GraphQL::Types::String, as: :sha, required: false, @@ -26,11 +24,8 @@ module Resolvers ::Resolvers::DesignManagement::VersionInCollectionResolver end - def resolve(parent: nil, id: nil, sha: nil) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id &&= VersionID.coerce_isolated_input(id) - version = cutoff(parent, id, sha) + def resolve(id: nil, sha: nil) + version = cutoff(id, sha) raise ::Gitlab::Graphql::Errors::ResourceNotAvailable, 'cutoff not found' unless version.present? @@ -44,11 +39,11 @@ module Resolvers private # Find the most recent version that the client will accept - def cutoff(parent, id, sha) + def cutoff(id, sha) if sha.present? || id.present? specific_version(id, sha) - elsif at_version = at_version_arg(parent) - by_id(at_version) + elsif at_version = context[:at_version_argument] + by_id(at_version) # See: DesignsResolver else :unconstrained end @@ -68,20 +63,6 @@ module Resolvers def by_id(gid) ::Gitlab::Graphql::Lazy.force(GitlabSchema.find_by_gid(gid)) end - - # Find an `at_version` argument passed to a parent node. - # - # If one is found, then a design collection further up the AST - # has been filtered to reflect designs at that version, and so - # for consistency we should only present versions up to the given - # version here. - def at_version_arg(parent) - # TODO: remove coercion when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - version_id = ::Gitlab::Graphql::FindArgumentInParent.find(parent, :at_version, limit_depth: 4) - version_id &&= VersionID.coerce_isolated_input(version_id) - version_id - end end end end |