Commit 5e1e08e5 authored by Douwe Maan's avatar Douwe Maan Committed by Fatih Acet

Show appropriate message when conflicts have already been resolved

parent 9eca67c9
......@@ -139,9 +139,14 @@ class Projects::MergeRequestsController < Projects::ApplicationController
format.json do
if @merge_request.conflicts_can_be_resolved_in_ui?
render json: @merge_request.conflicts
elsif @merge_request.can_be_merged?
render json: {
message: 'The merge conflicts for this merge request have already been resolved. Please return to the merge request.',
type: 'error'
}
else
render json: {
message: 'Unable to resolve conflicts in the web interface for this merge request.',
message: 'The merge conflicts for this merge request cannot be resolved through GitLab. Please try to resolve them locally.',
type: 'error'
}
end
......@@ -150,6 +155,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def resolve_conflicts
return render_404 unless @merge_request.conflicts_can_be_resolved_in_ui?
if @merge_request.can_be_merged?
render status: :bad_request, json: { message: 'The merge conflicts for this merge request have already been resolved.' }
return
end
begin
MergeRequests::ResolveService.new(project, current_user, params).execute(@merge_request)
......
......@@ -17,12 +17,12 @@
.loading{"v-if" => "isLoading"}
%i.fa.fa-spinner.fa-spin
.content-block.oneline-block{"v-if" => "hasError"}
%p {{conflictsData.errorMessage}}
.nothing-here-block{"v-if" => "hasError"}
{{conflictsData.errorMessage}}
= render partial: "projects/merge_requests/conflicts/commit_stats.html.haml"
= render partial: "projects/merge_requests/conflicts/commit_stats"
.files-wrapper{"v-if" => "!isLoading && !hasError"}
= render partial: "projects/merge_requests/conflicts/parallel_view.html.haml", locals: { class_bindings: class_bindings }
= render partial: "projects/merge_requests/conflicts/inline_view.html.haml", locals: { class_bindings: class_bindings }
= render partial: "projects/merge_requests/conflicts/submit_form.html.haml"
= render partial: "projects/merge_requests/conflicts/parallel_view", locals: { class_bindings: class_bindings }
= render partial: "projects/merge_requests/conflicts/inline_view", locals: { class_bindings: class_bindings }
= render partial: "projects/merge_requests/conflicts/submit_form"
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