Display custom hook error messages when automatic merge is enabled

parent 465b4ec5
......@@ -179,7 +179,7 @@ import MiniPipelineGraph from './mini_pipeline_graph_dropdown';
$('.ci-widget-fetching').show();
return $.getJSON(this.opts.ci_status_url, (function(_this) {
return function(data) {
var message, status, title;
var message, status, title, callback;
_this.status = data.status;
_this.hasCi = data.has_ci;
_this.updateMergeButton(_this.status, _this.hasCi);
......@@ -201,6 +201,12 @@ import MiniPipelineGraph from './mini_pipeline_graph_dropdown';
_this.opts.ci_sha = data.sha;
_this.updateCommitUrls(data.sha);
}
if (data.status === "success" || data.status === "failed") {
callback = function() {
return merge_request_widget.getMergeStatus();
};
return setTimeout(callback, 2000);
}
if (showNotification && data.status) {
status = _this.ciLabelForStatus(data.status);
if (status === "preparing") {
......
......@@ -12,6 +12,7 @@ module MergeRequests
close_merge_requests
reload_merge_requests
reset_merge_when_pipeline_succeeds
reset_merge_errors
mark_pending_todos_done
cache_merge_requests_closing_issues
......@@ -99,6 +100,12 @@ module MergeRequests
merge_requests_for_source_branch.each(&:reset_merge_when_pipeline_succeeds)
end
def reset_merge_errors
merge_requests_for_source_branch.each do |merge_request|
merge_request.update_attribute(:merge_error, nil)
end
end
def mark_pending_todos_done
merge_requests_for_source_branch.each do |merge_request|
todo_service.merge_request_push(merge_request, @current_user)
......
......@@ -27,14 +27,16 @@
= render 'projects/merge_requests/widget/open/conflicts'
- elsif @merge_request.work_in_progress?
= render 'projects/merge_requests/widget/open/wip'
- elsif @merge_request.should_be_rebased?
= render 'projects/merge_requests/widget/open/rebase'
- elsif @merge_request.merge_when_pipeline_succeeds? && @merge_request.merge_error.present?
= render 'projects/merge_requests/widget/open/error'
- elsif @merge_request.merge_when_pipeline_succeeds?
= render 'projects/merge_requests/widget/open/merge_when_pipeline_succeeds'
- elsif !@merge_request.can_be_merged_by?(current_user)
= render 'projects/merge_requests/widget/open/not_allowed'
- elsif !@merge_request.mergeable_ci_state? && (@pipeline.failed? || @pipeline.canceled?)
= render 'projects/merge_requests/widget/open/build_failed'
- elsif @merge_request.should_be_rebased?
= render 'projects/merge_requests/widget/open/rebase'
- elsif !@merge_request.mergeable_discussions_state?
= render 'projects/merge_requests/widget/open/unresolved_discussions'
- elsif @pipeline&.blocked?
......
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