Commit b305a133 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-create-mr-from-issue-with-template' into 'master'

Execute quick actions when creating MR from issue

Closes gitlab-ee#4277

See merge request gitlab-org/gitlab-ce!15810
parents f12be5c9 b1e3cb24
......@@ -106,12 +106,14 @@ class IssuableBaseService < BaseService
end
def merge_quick_actions_into_params!(issuable)
original_description = params.fetch(:description, issuable.description)
description, command_params =
QuickActions::InterpretService.new(project, current_user)
.execute(params[:description], issuable)
.execute(original_description, issuable)
# Avoid a description already set on an issuable to be overwritten by a nil
params[:description] = description if params.key?(:description)
params[:description] = description if description
params.merge!(command_params)
end
......
---
title: Execute quick actions (if present) when creating MR from issue
merge_request: 15810
author:
type: fixed
......@@ -100,5 +100,17 @@ describe MergeRequests::CreateFromIssueService do
expect(result[:merge_request].target_branch).to eq(project.default_branch)
end
it 'executes quick actions if the build service sets them in the description' do
allow(service).to receive(:merge_request).and_wrap_original do |m, *args|
m.call(*args).tap do |merge_request|
merge_request.description = "/assign #{user.to_reference}"
end
end
result = service.execute
expect(result[:merge_request].assignee).to eq(user)
end
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