From 242467cb99559c46c00d79b95f0717202b560bf3 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Wed, 21 Dec 2016 13:15:56 -0500 Subject: [PATCH] Fixes bug where selecting and deselecting users in the list was causing thes save button to be disabled improperly (#4533) --- .../organizations/linkout/addUsers/addUsers.controller.js | 7 ++++++- .../organizations/linkout/addUsers/addUsers.partial.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js index b45797a70b..e576ac5fd2 100644 --- a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js +++ b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js @@ -39,7 +39,12 @@ function($scope, $rootScope, ProcessErrors, GetBasePath, $scope.selectedItems.push(item.id); } else { - $scope.selectedItems = _.remove($scope.selectedItems, { id: item.id }); + // _.remove() Returns the new array of removed elements. + // This will pull all the values out of the array that don't + // match the deselected item effectively removing it + $scope.selectedItems = _.remove($scope.selectedItems, function(selectedItem) { + return selectedItem !== item.id; + }); } }); } diff --git a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.partial.html b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.partial.html index eb555b9dd8..df0d5233c6 100644 --- a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.partial.html +++ b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.partial.html @@ -27,7 +27,7 @@