function(opts) {
this.opts = opts;
- if($(".automerge_widget").lenght){
+ if($(".automerge_widget").length){
$.get(opts.url_to_automerge_check, function(data){
$(".automerge_widget").hide();
$(".automerge_widget." + data.state).show();
$('.status').removeClass("loading");
},
dataType: "script"});
+ },
+
+ already_cannot_be_merged:
+ function(){
+ $(".automerge_widget").hide();
+ $(".automerge_widget.already_cannot_be_merged").show();
}
}
end
def automerge
- render_404 unless @merge_request.open? && @merge_request.can_be_merged?
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
def destroy