From 96a847b5e18cc3f6ecceb4c6b0a3de7401aabfcd Mon Sep 17 00:00:00 2001 From: Brandon Griffin Date: Sat, 31 Oct 2015 12:43:27 -0400 Subject: [PATCH] Added check to see if repo exists in list before adding it --- .gitignore | 1 + lib/static/static/js/controllers/repositoriesCtrl.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index ee47622..b284f1b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ config.js server.* .vagrant main.css +config.js.txt diff --git a/lib/static/static/js/controllers/repositoriesCtrl.js b/lib/static/static/js/controllers/repositoriesCtrl.js index bb1e76e..f12aae3 100644 --- a/lib/static/static/js/controllers/repositoriesCtrl.js +++ b/lib/static/static/js/controllers/repositoriesCtrl.js @@ -58,6 +58,11 @@ } function addRepo(repo) { + for (var i = 0; i < $scope.repositories.length; i++) + if ($scope.repositories[i].id === repo.id) + return; + + var newRepos = $scope.repositories.concat(repo); newRepos.sort(function(a,b) { return a.full_name.localeCompare(b.full_name); }); $scope.repositories = newRepos;