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
This commit is contained in:
commit
b305a1331c
3 changed files with 21 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue