debian-mirror-gitlab/app/graphql/resolvers/project_milestones_resolver.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
710 B
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05:30
# frozen_string_literal: true
2021-01-29 00:20:46 +05:30
# rubocop:disable Graphql/ResolverType (inherited from MilestonesResolver)
2020-10-24 23:57:45 +05:30
module Resolvers
class ProjectMilestonesResolver < MilestonesResolver
2021-10-27 15:23:28 +05:30
argument :include_ancestors, GraphQL::Types::Boolean,
2020-10-24 23:57:45 +05:30
required: false,
2021-03-08 18:12:59 +05:30
description: "Also return milestones in the project's parent group and its ancestors."
2020-10-24 23:57:45 +05:30
2021-01-29 00:20:46 +05:30
type Types::MilestoneType.connection_type, null: true
2020-10-24 23:57:45 +05:30
private
def parent_id_parameters(args)
return { project_ids: parent.id } unless args[:include_ancestors].present? && parent.group.present?
{
group_ids: parent.group.self_and_ancestors.select(:id),
project_ids: parent.id
}
end
end
end