Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2019-05-21 00:19:00 +0300
committerBrett Walker <bwalker@gitlab.com>2019-05-21 01:23:11 +0300
commit0f14b628c4e9624c42e783c0e6620e8b00073ab6 (patch)
treee19c7d187c982101ba3ddb279054ad1b3458f6f8 /app/graphql
parentd951f047198d3ee03604fb64f6ad96efae6cba54 (diff)
Use BatchModelLoader for parent in GroupType
Diffstat (limited to 'app/graphql')
-rw-r--r--app/graphql/types/group_type.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb
index a2d615ee732..530aecc2bf9 100644
--- a/app/graphql/types/group_type.rb
+++ b/app/graphql/types/group_type.rb
@@ -8,14 +8,16 @@ module Types
expose_permissions Types::PermissionTypes::Group
- field :web_url, GraphQL::STRING_TYPE, null: true
+ field :web_url, GraphQL::STRING_TYPE, null: false
field :avatar_url, GraphQL::STRING_TYPE, null: true, resolve: -> (group, args, ctx) do
group.avatar_url(only_path: false)
end
if ::Group.supports_nested_objects?
- field :parent, GroupType, null: true
+ field :parent, GroupType,
+ null: true,
+ resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find }
end
end
end