Allow updating user subscriptions on a work item with GraphQL
Related to #389443 (closed)
What does this MR do and why?
In !113416 (merged) we added the Notifications widget to work items that returns the subscription state for the current user.
This MR extends the widget so it can be updated with the updateWorkItem mutation using the subscribed argument.
How to set up and validate locally
- Create a new work item and make a note of its ID
project, root = Project.first, User.first
wi = WorkItem.create!(author: root, project: project, title: 'Test Work Item', work_item_type_id: 1)
wi.id
- Log in as
rootand visithttp://gdk.test:3000/gitlab-org/gitlab-test/-/issues/{WORK_ITEM_ID}. The notifications toggle in the right sidebar should be on. - Visit
http://gdk.test:3000/-/graphql-explorerand run the following mutation:
mutation updateWorkItem {
workItemUpdate(input: {id: "gid://gitlab/WorkItem/WORK_ITEM_ID", notificationsWidget: {subscribed: false}}) {
workItem {
id
widgets{
... on WorkItemWidgetNotifications {
subscribed
}
}
}
}
}
- Visit
http://gdk.test:3000/gitlab-org/gitlab-test/-/issues/{WORK_ITEM_ID}and verify that the notifications toggle is off. - Execute mutation one more time changing the argument to
subscribed: trueand verify again that the response and toggle match the expected value.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Eugenia Grieff