Commit 6d3bb508f5616521f530c535dff5d889d846e617
Exists in
master
and in
4 other branches
Merge branch 'bug/mr_iids_duplicate' of /home/git/repositories/gitlab/gitlabhq
Showing
2 changed files
with
7 additions
and
2 deletions
Show diff stats
app/controllers/projects/merge_requests_controller.rb
... | ... | @@ -94,6 +94,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController |
94 | 94 | return |
95 | 95 | end |
96 | 96 | |
97 | + # We dont allow change of source/target projects | |
98 | + # after merge request was created | |
99 | + params[:merge_request].delete(:source_project_id) | |
100 | + params[:merge_request].delete(:target_project_id) | |
101 | + | |
97 | 102 | if @merge_request.update_attributes(params[:merge_request].merge(author_id_of_changes: current_user.id)) |
98 | 103 | @merge_request.reload_code |
99 | 104 | @merge_request.mark_as_unchecked | ... | ... |
app/views/projects/merge_requests/_form.html.haml
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | .span5 |
11 | 11 | .clearfix |
12 | 12 | .pull-left |
13 | - = f.select(:source_project_id,[[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, {class: 'source_project chosen span3'}) | |
13 | + = f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project chosen span3', disabled: @merge_request.persisted? }) | |
14 | 14 | .pull-left |
15 | 15 | |
16 | 16 | = f.select(:source_branch, @merge_request.source_project.repository.branch_names, { include_blank: "Select branch" }, {class: 'source_branch chosen span2'}) |
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | .clearfix |
23 | 23 | .pull-left |
24 | 24 | - projects = @project.forked_from_project.nil? ? [@project] : [ @project,@project.forked_from_project] |
25 | - = f.select(:target_project_id, projects.map { |proj| [proj.path_with_namespace,proj.id] }, {include_blank: "Select Target Project" }, {class: 'target_project chosen span3'}) | |
25 | + = f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace'), {}, { class: 'target_project chosen span3', disabled: @merge_request.persisted? }) | |
26 | 26 | .pull-left |
27 | 27 | |
28 | 28 | = f.select(:target_branch, @target_branches, { include_blank: "Select branch" }, {class: 'target_branch chosen span2'}) | ... | ... |