Commit a115267e authored by haseeb's avatar haseeb

working version of create merge requests with labels

parent f6d75f09
...@@ -212,7 +212,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -212,7 +212,7 @@ class Projects::IssuesController < Projects::ApplicationController
end end
def create_merge_request def create_merge_request
result = ::MergeRequests::CreateFromIssueService.new(project, current_user, issue_iid: issue.iid).execute result = ::MergeRequests::CreateFromIssueService.new(project, current_user, merge_request_params).execute
if result[:status] == :success if result[:status] == :success
render json: MergeRequestCreateSerializer.new.represent(result[:merge_request]) render json: MergeRequestCreateSerializer.new.represent(result[:merge_request])
...@@ -287,4 +287,14 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -287,4 +287,14 @@ class Projects::IssuesController < Projects::ApplicationController
redirect_to new_user_session_path, notice: notice redirect_to new_user_session_path, notice: notice
end end
private
def merge_request_params
{
issue_iid: issue.iid,
label_ids: issue.label_ids,
milestone_id: issue.milestone_id
}
end
end end
...@@ -43,9 +43,7 @@ module MergeRequests ...@@ -43,9 +43,7 @@ module MergeRequests
{ {
source_project_id: project.id, source_project_id: project.id,
source_branch: branch_name, source_branch: branch_name,
target_project_id: project.id, target_project_id: project.id
labels: issue.labels,
milestone_id: issue.milestone_id
} }
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