diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-06-20 10:41:07 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-06-20 10:41:07 +0000 |
commit | 07956981623d6c5a789fc78c8840079b5b73a5b1 (patch) | |
tree | 10ca80b1417b4e7585f1ce533df2f6fdb3e411d1 /app/views | |
parent | b2eef41d41d603bf9d5340f26bbe640363f608e6 (diff) | |
parent | c8d4a408f8594c6483c2d1b28706d53e5bd41529 (diff) | |
download | gitlab-ce-07956981623d6c5a789fc78c8840079b5b73a5b1.tar.gz |
Merge branch 'new-mr-disable-change-target-branch' into 'master'
Disable changing of target branch in new merge request page when a branch has already been specified
### What does this MR do?
This MR prevents a user from changing the target branch inside a new merge request page if the target branch has already been specified (e.g. from the shortcut in the activity feed). A link to "Change branches" is provided to allow the user to do this properly.
### Why was this MR needed?
If a user attempted to create a merge request from a shortcut with a pre-specified target branch (e.g. `master`), the dropdown would suggest that the user could change the branch. However, this did not actually work due to duplicate data elements (see #1830 for more details), and the target branch would always be set to the original, default branch. This would lead to confusion, potentially causing an improper merge request to be created.
### What are the relevant issue numbers?
Closes #1830
### Screenshot
![image](https://gitlab.com/stanhu/gitlab-ce/uploads/eeec4f5d4b66625a14be41e5ecbdc016/image.png)
See merge request !846
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/projects/_issuable_form.html.haml | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/views/projects/_issuable_form.html.haml b/app/views/projects/_issuable_form.html.haml index 4d93c89c93a..496fad34dc2 100644 --- a/app/views/projects/_issuable_form.html.haml +++ b/app/views/projects/_issuable_form.html.haml @@ -15,10 +15,10 @@ - if issuable.is_a?(MergeRequest) %p.help-block - if issuable.work_in_progress? - Remove the <code>WIP</code> prefix from the title to allow this + Remove the <code>WIP</code> prefix from the title to allow this <strong>Work In Progress</strong> merge request to be accepted when it's ready. - else - Start the title with <code>[WIP]</code> or <code>WIP:</code> to prevent a + Start the title with <code>[WIP]</code> or <code>WIP:</code> to prevent a <strong>Work In Progress</strong> merge request from being accepted before it's ready. .form-group.issuable-description = f.label :description, 'Description', class: 'control-label' @@ -81,21 +81,22 @@ - if issuable.is_a?(MergeRequest) %hr - - unless @merge_request.persisted? + - if @merge_request.new_record? .form-group = f.label :source_branch, class: 'control-label' do %i.fa.fa-code-fork Source Branch .col-sm-10 = f.select(:source_branch, [@merge_request.source_branch], { }, { class: 'source_branch select2 span2', disabled: true }) - %p.help-block - = link_to 'Change source branch', mr_change_branches_path(@merge_request) .form-group = f.label :target_branch, class: 'control-label' do %i.fa.fa-code-fork Target Branch .col-sm-10 - = f.select(:target_branch, @merge_request.target_branches, { include_blank: "Select branch" }, { class: 'target_branch select2 span2' }) + = f.select(:target_branch, @merge_request.target_branches, { include_blank: "Select branch" }, { class: 'target_branch select2 span2', disabled: @merge_request.new_record? }) + - if @merge_request.new_record? + %p.help-block + = link_to 'Change branches', mr_change_branches_path(@merge_request) .form-actions - if !issuable.project.empty_repo? && (guide_url = contribution_guide_url(issuable.project)) && !issuable.persisted? |