diff options
author | Brett Walker <bwalker@gitlab.com> | 2019-05-21 00:19:00 +0300 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2019-05-21 01:23:11 +0300 |
commit | 0f14b628c4e9624c42e783c0e6620e8b00073ab6 (patch) | |
tree | e19c7d187c982101ba3ddb279054ad1b3458f6f8 /app/graphql | |
parent | d951f047198d3ee03604fb64f6ad96efae6cba54 (diff) |
Use BatchModelLoader for parent in GroupType
Diffstat (limited to 'app/graphql')
-rw-r--r-- | app/graphql/types/group_type.rb | 6 |
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 |