summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorblackst0ne <blackst0ne.ru@gmail.com>2018-10-23 12:00:28 +1100
committerblackst0ne <blackst0ne.ru@gmail.com>2018-10-23 12:00:28 +1100
commite211ef4e9d3a1d1b44872b600d694afc38d4d820 (patch)
treea3b350275fcfb93f69b21fd6252b1a264fb187cc /app
parent4cf1845e7ea5d9a52fe5af49dd1644f98a921010 (diff)
downloadgitlab-ce-e211ef4e9d3a1d1b44872b600d694afc38d4d820.tar.gz
Make new merge request URL more friendly when pushing code
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/merge_requests/creations_controller.rb2
-rw-r--r--app/services/merge_requests/get_urls_service.rb4
2 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/projects/merge_requests/creations_controller.rb b/app/controllers/projects/merge_requests/creations_controller.rb
index 5639402a1e9..bbf662a63c8 100644
--- a/app/controllers/projects/merge_requests/creations_controller.rb
+++ b/app/controllers/projects/merge_requests/creations_controller.rb
@@ -89,6 +89,8 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
def build_merge_request
params[:merge_request] ||= ActionController::Parameters.new(source_project: @project)
+ params[:merge_request][:source_branch] ||= params[:merge_request_source_branch].presence
+
@merge_request = ::MergeRequests::BuildService.new(project, current_user, merge_request_params.merge(diff_options: diff_options)).execute
end
diff --git a/app/services/merge_requests/get_urls_service.rb b/app/services/merge_requests/get_urls_service.rb
index 7c88c9abb41..35a22449e34 100644
--- a/app/services/merge_requests/get_urls_service.rb
+++ b/app/services/merge_requests/get_urls_service.rb
@@ -50,8 +50,8 @@ module MergeRequests
end
def url_for_new_merge_request(branch_name)
- merge_request_params = { source_branch: branch_name }
- url = Gitlab::Routing.url_helpers.project_new_merge_request_url(project, merge_request: merge_request_params)
+ url = Gitlab::Routing.url_helpers.project_new_merge_request_url(project, branch_name)
+
{ branch_name: branch_name, url: url, new_merge_request: true }
end