Commit 68e91614 authored by James Fargher's avatar James Fargher

Merge branch '343668-update-work-item-title-mutation' into 'master'

WorkItemUpdate mutation allows to update title

See merge request gitlab-org/gitlab!80237
parents 3b180e9d 0696c302
......@@ -18,6 +18,9 @@ module Mutations
argument :state_event, Types::WorkItems::StateEventEnum,
description: 'Close or reopen a work item.',
required: false
argument :title, GraphQL::Types::String,
required: false,
description: copy_field_description(Types::WorkItemType, :title)
field :work_item, Types::WorkItemType,
null: true,
......
......@@ -5202,6 +5202,7 @@ Input type: `WorkItemUpdateInput`
| <a id="mutationworkitemupdateclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| <a id="mutationworkitemupdateid"></a>`id` | [`WorkItemID!`](#workitemid) | Global ID of the work item. |
| <a id="mutationworkitemupdatestateevent"></a>`stateEvent` | [`WorkItemStateEvent`](#workitemstateevent) | Close or reopen a work item. |
| <a id="mutationworkitemupdatetitle"></a>`title` | [`String`](#string) | Title of the work item. |
#### Fields
......@@ -10,7 +10,7 @@ RSpec.describe 'Update a work item' do
let_it_be(:work_item, refind: true) { create(:work_item, project: project) }
let(:work_item_event) { 'CLOSE' }
let(:input) { { 'stateEvent' => work_item_event } }
let(:input) { { 'stateEvent' => work_item_event, 'title' => 'updated title' } }
let(:mutation) { graphql_mutation(:workItemUpdate, input.merge('id' => work_item.to_global_id.to_s)) }
......@@ -26,15 +26,18 @@ RSpec.describe 'Update a work item' do
let(:current_user) { developer }
context 'when the work item is open' do
it 'closes the work item' do
it 'closes and updates the work item' do
expect do
post_graphql_mutation(mutation, current_user: current_user)
work_item.reload
end.to change(work_item, :state).from('opened').to('closed')
end.to change(work_item, :state).from('opened').to('closed').and(
change(work_item, :title).from(work_item.title).to('updated title')
)
expect(response).to have_gitlab_http_status(:success)
expect(mutation_response['workItem']).to include(
'state' => 'CLOSED'
'state' => 'CLOSED',
'title' => 'updated title'
)
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