Commit 6d2339a2 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '233942-expose-approved-boolean-flag-for-merge-requests-in-graphql' into 'master'

Expose approved flag in MR GraphQL type

Closes #233942

See merge request gitlab-org/gitlab!40505
parents bf2fbcaa 83784472
......@@ -8547,6 +8547,11 @@ type MergeRequest implements Noteable {
"""
allowCollaboration: Boolean
"""
Indicates if the merge request has all the required approvals. Returns true if no required approvals are configured.
"""
approved: Boolean!
"""
Users who approved the merge request
"""
......
......@@ -23818,6 +23818,24 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "approved",
"description": "Indicates if the merge request has all the required approvals. Returns true if no required approvals are configured.",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "approvedBy",
"description": "Users who approved the merge request",
......@@ -1319,6 +1319,7 @@ Autogenerated return type of MarkAsSpamSnippet
| Name | Type | Description |
| --- | ---- | ---------- |
| `allowCollaboration` | Boolean | Indicates if members of the target project can push to the fork |
| `approved` | Boolean! | Indicates if the merge request has all the required approvals. Returns true if no required approvals are configured. |
| `author` | User | User who created this merge request |
| `commitCount` | Int | Number of commits in the merge request |
| `createdAt` | Time! | Timestamp of when the merge request was created |
......
......@@ -6,6 +6,8 @@ module EE
extend ActiveSupport::Concern
prepended do
field :approved, GraphQL::BOOLEAN_TYPE, method: :approved?, null: false,
description: 'Indicates if the merge request has all the required approvals. Returns true if no required approvals are configured.'
field :approved_by, ::Types::UserType.connection_type, null: true,
description: 'Users who approved the merge request'
......
---
title: Expose approved flag in Merge Request GraphQL API
merge_request: 40505
author:
type: added
......@@ -27,7 +27,10 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do
total_time_spent reference author merged_at commit_count
]
expected_fields << 'approved_by' if Gitlab.ee?
if Gitlab.ee?
expected_fields << 'approved'
expected_fields << 'approved_by'
end
expect(described_class).to have_graphql_fields(*expected_fields)
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