Skip to content
Snippets Groups Projects
Commit e8a52fdf authored by Sincheol (David) Kim's avatar Sincheol (David) Kim
Browse files

Make /merge quick action to work in GraphQL via createDiffNote

Changelog: fixed
parent 2e1e20e1
No related branches found
No related tags found
1 merge request!92319Make /merge quick action to work in GraphQL via createDiffNote
......@@ -32,7 +32,8 @@ def ready?(**args)
def create_note_params(noteable, args)
super(noteable, args).merge({
type: 'DiffNote',
position: position(noteable, args)
position: position(noteable, args),
merge_request_diff_head_sha: args[:position][:head_sha]
})
end
......
......@@ -10,11 +10,12 @@
let(:noteable) { create(:merge_request, source_project: project, target_project: project) }
let(:project) { create(:project, :repository) }
let(:diff_refs) { noteable.diff_refs }
let(:body) { 'Body text' }
let(:base_variables) do
{
noteable_id: GitlabSchema.id_from_object(noteable).to_s,
body: 'Body text',
body: body,
position: {
paths: {
old_path: 'files/ruby/popen.rb',
......@@ -65,6 +66,17 @@ def mutation_response
it_behaves_like 'a Note mutation when the given resource id is not for a Noteable'
end
context 'with /merge quick action' do
let(:body) { "Body text \n/merge" }
it 'merges the merge request', :sidekiq_inline do
post_graphql_mutation(mutation, current_user: current_user)
expect(noteable.reload.state).to eq('merged')
expect(mutation_response['note']['body']).to eq('Body text')
end
end
it 'returns the note with the correct position' do
post_graphql_mutation(mutation, current_user: current_user)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment