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