[GraphQL] Add query support for user's merge requests
What does this MR do?
Addresses: #217475 (closed)
This MR adds missing functionality in GraphQL to:
- find MRs by a given author
- find MRs assigned to a given author
To support this, we also need to find users by username.
Example Query
query {
root: user(username: "root") {
allAssignedMRs: assignedMergeRequests {
nodes { title }
}
deliverables: assignedMergeRequests(labels: ["Altima"]) {
nodes { title, description }
}
authoredMergeRequests(projectPath: "gitlab-org/gitlab-test") {
nodes { title, description, project {fullPath} }
}
}
}
Example response:
{
"data": {
"root": {
"allAssignedMRs": {
"nodes": [
{
"title": "Voluptas fuga dolor soluta reprehenderit amet perferendis at debitis."
},
{
"title": "Voluptatum quibusdam non rerum ut et sed."
},
{
"title": "Vel velit consequuntur nemo ut omnis provident."
},
{
"title": "Sed pariatur omnis aut inventore repellat ut."
}
]
},
"deliverables": {
"nodes": [
{
"title": "Vel velit consequuntur nemo ut omnis provident.",
"description": "Natus voluptatibus voluptatem sit atque. Dolorem atque et eius qui. Fuga omnis corrupti est sed iusto."
}
]
},
"authoredMergeRequests": {
"nodes": [
{
"title": "Cannot be automatically merged",
"description": null,
"project": {
"fullPath": "gitlab-org/gitlab-test"
}
},
{
"title": "Can be automatically merged",
"description": null,
"project": {
"fullPath": "gitlab-org/gitlab-test"
}
},
{
"title": "Animi alias aliquam delectus voluptatem deleniti error voluptates perspiciatis ut.",
"description": "Eum ab nulla sapiente sit maxime veniam. Eaque quas veritatis inventore quo atque. Consequatur sint quia vitae itaque tenetur.",
"project": {
"fullPath": "gitlab-org/gitlab-test"
}
}
]
}
}
}
}
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Alex Kalderimis