Commit a163135cb5bd9886b634d8026b7adf473b023782
1 parent
a0cc3882
Exists in
master
and in
4 other branches
Intead of showing 404 give users ability to close MR with missing branches
Showing
6 changed files
with
40 additions
and
16 deletions
Show diff stats
app/assets/stylesheets/common.scss
... | ... | @@ -543,3 +543,15 @@ img.emoji { |
543 | 543 | .appear-data { |
544 | 544 | display: none; |
545 | 545 | } |
546 | + | |
547 | +.label-branch { | |
548 | + @include border-radius(4px); | |
549 | + padding: 2px 4px; | |
550 | + border: none; | |
551 | + font-size: 14px; | |
552 | + background: #474D57; | |
553 | + color: #fff; | |
554 | + font-family: $monospace_font; | |
555 | + text-shadow: 0 1px 1px #111; | |
556 | + font-weight: normal; | |
557 | +} | ... | ... |
app/assets/stylesheets/sections/merge_requests.scss
... | ... | @@ -70,16 +70,6 @@ li.merge_request { |
70 | 70 | @extend .append-bottom-10; |
71 | 71 | } |
72 | 72 | |
73 | -.label_branch { | |
74 | - @include border-radius(4px); | |
75 | - padding: 2px 4px; | |
76 | - border: none; | |
77 | - font-size: 14px; | |
78 | - background: #474D57; | |
79 | - color: #fff; | |
80 | - font-family: $monospace_font; | |
81 | -} | |
82 | - | |
83 | 73 | .mr_source_commit, |
84 | 74 | .mr_target_commit { |
85 | 75 | .commit { | ... | ... |
app/controllers/merge_requests_controller.rb
... | ... | @@ -129,11 +129,11 @@ class MergeRequestsController < ProjectResourceController |
129 | 129 | |
130 | 130 | def validates_merge_request |
131 | 131 | # Show git not found page if target branch doesn't exist |
132 | - return git_not_found! unless @project.repo.heads.map(&:name).include?(@merge_request.target_branch) | |
132 | + return invalid_mr unless @project.repo.heads.map(&:name).include?(@merge_request.target_branch) | |
133 | 133 | |
134 | 134 | # Show git not found page if source branch doesn't exist |
135 | 135 | # and there is no saved commits between source & target branch |
136 | - return git_not_found! if !@project.repo.heads.map(&:name).include?(@merge_request.source_branch) && @merge_request.commits.blank? | |
136 | + return invalid_mr if !@project.repo.heads.map(&:name).include?(@merge_request.source_branch) && @merge_request.commits.blank? | |
137 | 137 | end |
138 | 138 | |
139 | 139 | def define_show_vars |
... | ... | @@ -158,4 +158,9 @@ class MergeRequestsController < ProjectResourceController |
158 | 158 | |
159 | 159 | can?(current_user, action, @project) |
160 | 160 | end |
161 | + | |
162 | + def invalid_mr | |
163 | + # Render special view for MR with removed source or target branch | |
164 | + render 'invalid' | |
165 | + end | |
161 | 166 | end | ... | ... |
app/views/compare/_form.html.haml
... | ... | @@ -2,9 +2,9 @@ |
2 | 2 | - unless params[:to] |
3 | 3 | %p.slead |
4 | 4 | Fill input field with commit id like |
5 | - %code.label_branch 4eedf23 | |
5 | + %code.label-branch 4eedf23 | |
6 | 6 | or branch/tag name like |
7 | - %code.label_branch master | |
7 | + %code.label-branch master | |
8 | 8 | and press compare button for commits list, code diff. |
9 | 9 | |
10 | 10 | %br | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +.merge-request | |
2 | + = render "merge_requests/show/mr_title" | |
3 | + = render "merge_requests/show/mr_box" | |
4 | + | |
5 | + .alert.alert-error | |
6 | + %h5 | |
7 | + %i.icon-exclamation-sign | |
8 | + We cannot find | |
9 | + %span.label-branch= @merge_request.source_branch | |
10 | + or | |
11 | + %span.label-branch= @merge_request.target_branch | |
12 | + branches in the repository. | |
13 | + %p | |
14 | + Maybe it was removed or never pushed. | |
15 | + %p | |
16 | + Please close Merge Request or change branches with existing one | |
17 | + | ... | ... |
app/views/merge_requests/show/_mr_title.html.haml
1 | 1 | %h3.page_title |
2 | 2 | = "Merge Request ##{@merge_request.id}:" |
3 | 3 | |
4 | - %span.label_branch= @merge_request.source_branch | |
4 | + %span.label-branch= @merge_request.source_branch | |
5 | 5 | → |
6 | - %span.label_branch= @merge_request.target_branch | |
6 | + %span.label-branch= @merge_request.target_branch | |
7 | 7 | |
8 | 8 | %span.pull-right |
9 | 9 | - if can?(current_user, :modify_merge_request, @merge_request) | ... | ... |