diff options
Diffstat (limited to 'app/graphql')
-rw-r--r-- | app/graphql/resolvers/issues_resolver.rb | 11 | ||||
-rw-r--r-- | app/graphql/types/group_type.rb | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/app/graphql/resolvers/issues_resolver.rb b/app/graphql/resolvers/issues_resolver.rb index ae77af32b5b..04da54a6bb6 100644 --- a/app/graphql/resolvers/issues_resolver.rb +++ b/app/graphql/resolvers/issues_resolver.rb @@ -56,12 +56,17 @@ module Resolvers # The project could have been loaded in batch by `BatchLoader`. # At this point we need the `id` of the project to query for issues, so # make sure it's loaded and not `nil` before continuing. - project = object.respond_to?(:sync) ? object.sync : object - return Issue.none if project.nil? + parent = object.respond_to?(:sync) ? object.sync : object + return Issue.none if parent.nil? + + if parent.is_a?(Group) + args[:group_id] = parent.id + else + args[:project_id] = parent.id + end # Will need to be be made group & namespace aware with # https://gitlab.com/gitlab-org/gitlab-foss/issues/54520 - args[:project_id] = project.id args[:iids] ||= [args[:iid]].compact args[:attempt_project_search_optimizations] = args[:search].present? diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb index bd9efef94f8..20b4c66ba95 100644 --- a/app/graphql/types/group_type.rb +++ b/app/graphql/types/group_type.rb @@ -43,6 +43,12 @@ module Types description: 'Parent group', resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find } + field :issues, + Types::IssueType.connection_type, + null: true, + description: 'Issues of the group', + resolver: Resolvers::IssuesResolver + field :milestones, Types::MilestoneType.connection_type, null: true, description: 'Find milestones', resolver: Resolvers::MilestoneResolver |