Commit 60fd4188 authored by Phil Hughes's avatar Phil Hughes

Build notification null check

Cancels build notification interval on page change
parent 8b7ce2ad
......@@ -12,10 +12,19 @@ class @MergeRequestWidget
@readyForCICheck = true
clearInterval @fetchBuildStatusInterval
@clearEventListeners()
@addEventListeners()
@pollCIStatus()
notifyPermissions()
setOpts: (@opts) ->
clearEventListeners: ->
$(document).off 'page:change.merge_request'
addEventListeners: ->
$(document).on 'page:change.merge_request', =>
if $('body').data('page') isnt 'projects:merge_requests:show'
clearInterval @fetchBuildStatusInterval
@clearEventListeners()
mergeInProgress: (deleteSourceBranch = false)->
$.ajax
......@@ -63,11 +72,15 @@ class @MergeRequestWidget
@firstCICheck = false
@opts.ci_status = data.status
<<<<<<< a918e8bf277418048776a5d9c34a64b39f4e56f3
if @opts.ci_status is ''
@opts.ci_status = data.status
return
if data.status isnt @opts.ci_status
=======
if data.status isnt @opts.ci_status and data.status?
>>>>>>> Build notification null check
@showCIStatus data.status
if data.coverage
@showCICoverage data.coverage
......
......@@ -8,7 +8,6 @@
= render 'projects/merge_requests/widget/locked'
:javascript
var merge_request_widget;
var opts = {
merge_check_url: "#{merge_check_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}",
check_enable: #{@merge_request.unchecked? ? "true" : "false"},
......@@ -20,8 +19,4 @@
builds_path: "#{builds_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}"
};
if(typeof merge_request_widget === 'undefined') {
merge_request_widget = new MergeRequestWidget(opts);
} else {
merge_request_widget.setOpts(opts);
}
new MergeRequestWidget(opts);
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