Commit 27d2d9d4 authored by Alan (Maciej) Paruszewski's avatar Alan (Maciej) Paruszewski Committed by James Fargher

Change type of ApprovalState.eligibleApprovers in GraphQL API

parent 13646226
...@@ -7605,7 +7605,7 @@ Describes a rule for who can approve merge requests. ...@@ -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="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="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="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="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="approvalruleid"></a>`id` | [`GlobalID!`](#globalid) | ID of the rule. |
| <a id="approvalrulename"></a>`name` | [`String`](#string) | Name of the rule. | | <a id="approvalrulename"></a>`name` | [`String`](#string) | Name of the rule. |
......
...@@ -58,7 +58,7 @@ module Types ...@@ -58,7 +58,7 @@ module Types
description: 'Source rule used to create the rule.' description: 'Source rule used to create the rule.'
field :eligible_approvers, field :eligible_approvers,
type: ::Types::UserType.connection_type, type: [::Types::UserType],
method: :approvers, method: :approvers,
null: true, null: true,
description: 'List of all users eligible to approve the merge request (defined explicitly and from associated groups).' 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 ...@@ -58,7 +58,7 @@ RSpec.describe 'MergeRequestReviewer' do
end end
it 'returns appropriate data' do it 'returns appropriate data' do
the_rule = eq( the_rule = {
'id' => global_id_of(rule), 'id' => global_id_of(rule),
'name' => rule.name, 'name' => rule.name,
'type' => 'CODE_OWNER', 'type' => 'CODE_OWNER',
...@@ -68,11 +68,11 @@ RSpec.describe 'MergeRequestReviewer' do ...@@ -68,11 +68,11 @@ RSpec.describe 'MergeRequestReviewer' do
'overridden' => false, 'overridden' => false,
'section' => 'codeowners', 'section' => 'codeowners',
'sourceRule' => nil 'sourceRule' => nil
) }
post_graphql(query) post_graphql(query)
expect(interaction['applicableApprovalRules']).to contain_exactly(the_rule) expect(interaction['applicableApprovalRules'].first).to include(the_rule)
end end
end end
end end
......
...@@ -26,6 +26,27 @@ RSpec.describe 'Query.project.mergeRequest.approvalState' do ...@@ -26,6 +26,27 @@ RSpec.describe 'Query.project.mergeRequest.approvalState' do
containsHiddenGroups containsHiddenGroups
overridden overridden
section section
eligibleApprovers {
id
}
users {
nodes {
id
}
}
sourceRule {
id
}
approvedBy {
nodes {
id
}
}
groups {
nodes {
id
}
}
} }
} }
QUERY QUERY
...@@ -77,12 +98,17 @@ RSpec.describe 'Query.project.mergeRequest.approvalState' do ...@@ -77,12 +98,17 @@ RSpec.describe 'Query.project.mergeRequest.approvalState' do
'rules' => [{ 'rules' => [{
'approvalsRequired' => 0, 'approvalsRequired' => 0,
'approved' => true, 'approved' => true,
'approvedBy' => { 'nodes' => [] },
'containsHiddenGroups' => false, 'containsHiddenGroups' => false,
'eligibleApprovers' => [{ 'id' => global_id_of(user) }],
'groups' => { 'nodes' => [] },
'id' => global_id_of(code_owner_rule), 'id' => global_id_of(code_owner_rule),
'name' => code_owner_rule.name, 'name' => '*-1.js',
'overridden' => false, 'overridden' => false,
'section' => 'codeowners', 'section' => 'codeowners',
'type' => 'CODE_OWNER' 'sourceRule' => nil,
'type' => 'CODE_OWNER',
'users' => { 'nodes' => [{ 'id' => global_id_of(user) }] }
}] }]
}) })
end 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