summaryrefslogtreecommitdiff
path: root/app/graphql
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2019-05-20 16:19:00 -0500
committerBrett Walker <bwalker@gitlab.com>2019-05-20 17:23:11 -0500
commit0f14b628c4e9624c42e783c0e6620e8b00073ab6 (patch)
treee19c7d187c982101ba3ddb279054ad1b3458f6f8 /app/graphql
parentd951f047198d3ee03604fb64f6ad96efae6cba54 (diff)
downloadgitlab-ce-0f14b628c4e9624c42e783c0e6620e8b00073ab6.tar.gz
Use BatchModelLoader for parent in GroupType62066-use-batchmodelloader-for-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