Commit 57a73af2 authored by James Fargher's avatar James Fargher

Merge branch '323116-chsange-approval-graphql-type-for-approvers' into 'master'

Change type of ApprovalState.eligibleApprovers in GraphQL API

See merge request gitlab-org/gitlab!68709
parents 838d9201 27d2d9d4
......@@ -7605,7 +7605,7 @@ Describes a rule for who can approve merge requests.
| <a id="approvalruleapproved"></a>`approved` | [`Boolean`](#boolean) | Indicates if the rule is satisfied. |
| <a id="approvalruleapprovedby"></a>`approvedBy` | [`UserCoreConnection`](#usercoreconnection) | List of users defined in the rule that approved the merge request. (see [Connections](#connections)) |
| <a id="approvalrulecontainshiddengroups"></a>`containsHiddenGroups` | [`Boolean`](#boolean) | Indicates if the rule contains approvers from a hidden group. |
| <a id="approvalruleeligibleapprovers"></a>`eligibleApprovers` | [`UserCoreConnection`](#usercoreconnection) | List of all users eligible to approve the merge request (defined explicitly and from associated groups). (see [Connections](#connections)) |
| <a id="approvalruleeligibleapprovers"></a>`eligibleApprovers` | [`[UserCore!]`](#usercore) | List of all users eligible to approve the merge request (defined explicitly and from associated groups). |
| <a id="approvalrulegroups"></a>`groups` | [`GroupConnection`](#groupconnection) | List of groups added as approvers for the rule. (see [Connections](#connections)) |
| <a id="approvalruleid"></a>`id` | [`GlobalID!`](#globalid) | ID of the rule. |
| <a id="approvalrulename"></a>`name` | [`String`](#string) | Name of the rule. |
......
......@@ -58,7 +58,7 @@ module Types
description: 'Source rule used to create the rule.'
field :eligible_approvers,
type: ::Types::UserType.connection_type,
type: [::Types::UserType],
method: :approvers,
null: true,
description: 'List of all users eligible to approve the merge request (defined explicitly and from associated groups).'
......
......@@ -58,7 +58,7 @@ RSpec.describe 'MergeRequestReviewer' do
end
it 'returns appropriate data' do
the_rule = eq(
the_rule = {
'id' => global_id_of(rule),
'name' => rule.name,
'type' => 'CODE_OWNER',
......@@ -68,11 +68,11 @@ RSpec.describe 'MergeRequestReviewer' do
'overridden' => false,
'section' => 'codeowners',
'sourceRule' => nil
)
}
post_graphql(query)
expect(interaction['applicableApprovalRules']).to contain_exactly(the_rule)
expect(interaction['applicableApprovalRules'].first).to include(the_rule)
end
end
end
......
......@@ -26,6 +26,27 @@ RSpec.describe 'Query.project.mergeRequest.approvalState' do
containsHiddenGroups
overridden
section
eligibleApprovers {
id
}
users {
nodes {
id
}
}
sourceRule {
id
}
approvedBy {
nodes {
id
}
}
groups {
nodes {
id
}
}
}
}
QUERY
......@@ -77,12 +98,17 @@ RSpec.describe 'Query.project.mergeRequest.approvalState' do
'rules' => [{
'approvalsRequired' => 0,
'approved' => true,
'approvedBy' => { 'nodes' => [] },
'containsHiddenGroups' => false,
'eligibleApprovers' => [{ 'id' => global_id_of(user) }],
'groups' => { 'nodes' => [] },
'id' => global_id_of(code_owner_rule),
'name' => code_owner_rule.name,
'name' => '*-1.js',
'overridden' => false,
'section' => 'codeowners',
'type' => 'CODE_OWNER'
'sourceRule' => nil,
'type' => 'CODE_OWNER',
'users' => { 'nodes' => [{ 'id' => global_id_of(user) }] }
}]
})
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment