Auto-merge: 'already can not be merged' alert
This commit is contained in:
parent
8269a3a735
commit
a8e4f3ed88
|
@ -7,7 +7,7 @@ var MergeRequest = {
|
||||||
function(opts) {
|
function(opts) {
|
||||||
this.opts = opts;
|
this.opts = opts;
|
||||||
|
|
||||||
if($(".automerge_widget").lenght){
|
if($(".automerge_widget").length){
|
||||||
$.get(opts.url_to_automerge_check, function(data){
|
$.get(opts.url_to_automerge_check, function(data){
|
||||||
$(".automerge_widget").hide();
|
$(".automerge_widget").hide();
|
||||||
$(".automerge_widget." + data.state).show();
|
$(".automerge_widget." + data.state).show();
|
||||||
|
@ -48,5 +48,11 @@ var MergeRequest = {
|
||||||
$('.status').removeClass("loading");
|
$('.status').removeClass("loading");
|
||||||
},
|
},
|
||||||
dataType: "script"});
|
dataType: "script"});
|
||||||
|
},
|
||||||
|
|
||||||
|
already_cannot_be_merged:
|
||||||
|
function(){
|
||||||
|
$(".automerge_widget").hide();
|
||||||
|
$(".automerge_widget.already_cannot_be_merged").show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,9 +104,13 @@ class MergeRequestsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def automerge
|
def automerge
|
||||||
render_404 unless @merge_request.open? && @merge_request.can_be_merged?
|
|
||||||
return access_denied! unless can?(current_user, :accept_mr, @project)
|
return access_denied! unless can?(current_user, :accept_mr, @project)
|
||||||
@merge_request.automerge!(current_user)
|
if @merge_request.open? && @merge_request.can_be_merged?
|
||||||
|
@merge_request.automerge!(current_user)
|
||||||
|
@status = true
|
||||||
|
else
|
||||||
|
@status = false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
:plain
|
-if @status
|
||||||
location.reload();
|
:plain
|
||||||
|
location.reload();
|
||||||
|
-else
|
||||||
|
:plain
|
||||||
|
MergeRequest.already_cannot_be_merged()
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,11 @@
|
||||||
.alert-message
|
.alert-message
|
||||||
%p
|
%p
|
||||||
%strong Checking for ability to automatically merge…
|
%strong Checking for ability to automatically merge…
|
||||||
|
|
||||||
|
.automerge_widget.already_cannot_be_merged{:style => "display:none"}
|
||||||
|
.alert-message
|
||||||
|
%p
|
||||||
|
%strong This merge request already can not be merged
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue