From 9403b1d951c47aca67d2bac1369b86c125c5119d Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 14 Jun 2018 15:06:53 +0200 Subject: Allow querying a single MR within a project This allows the user to get a single MR nested in a GraphQL project query. Since we need the full path and the iid anyway, this makes more sense than having a root query that needs the full path as well. --- app/graphql/types/project_type.rb | 7 +++++++ app/graphql/types/query_type.rb | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'app/graphql/types') diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 9e885d5845a..d9058ae7431 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -61,5 +61,12 @@ module Types field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true field :only_allow_merge_if_all_discussions_are_resolved, GraphQL::BOOLEAN_TYPE, null: true field :printing_merge_request_link_enabled, GraphQL::BOOLEAN_TYPE, null: true + + field :merge_request, + Types::MergeRequestType, + null: true, + resolver: Resolvers::MergeRequestResolver do + authorize :read_merge_request + end end end diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index be79c78bf67..010ec2d7942 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -9,13 +9,6 @@ module Types authorize :read_project end - field :merge_request, Types::MergeRequestType, - null: true, - resolver: Resolvers::MergeRequestResolver, - description: "Find a merge request" do - authorize :read_merge_request - end - field :echo, GraphQL::STRING_TYPE, null: false, function: Functions::Echo.new end end -- cgit v1.2.3