Only live update for existing builds

The build message will only be displayed for new builds as the new item will not be auto updated, if the build has been auto-updated no build message will be displayed.
This commit is contained in:
Andy Gardner 2015-01-22 10:53:10 +02:00
parent 217cf0bc23
commit 3e1b3c5871

View file

@ -13,7 +13,6 @@ angular.module('app').controller("RepoController", function($scope, $http, $rout
// display a toast message with the
// commit details, allowing the user to
// reload the page.
$scope.msg = item;
// Try find an existing commit for this SHA. If found, replace it
var sha_updated = $scope.commits.some(function(element, index) {
@ -22,9 +21,11 @@ angular.module('app').controller("RepoController", function($scope, $http, $rout
return element.sha == item.commit.sha;
});
// Add a new commit if the SHA couldn't be found but the new build status is 'Started'
if ( ! sha_updated && item.commit.status == 'Started')
$scope.commits.unshift(item.commit);
// Add a build message if the SHA couldn't be found and the new build status is 'Started'
if ( ! sha_updated && item.commit.status == 'Started') {
// $scope.commits.unshift(item.commit);
$scope.msg = item;
}
$scope.$apply();
} else {