From e03d4d52c4ef1e9d452afb3f5e07b7780ef25e33 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 10 May 2017 14:20:45 -0400 Subject: [PATCH] resolve issues with id on api calls --- .../organizationCollectionsAddController.js | 6 +++--- .../organizationCollectionsEditController.js | 11 ++++++---- .../organizationGroupsEditController.js | 11 ++++++---- .../organizationPeopleEditController.js | 20 +++++++++++-------- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/app/organization/organizationCollectionsAddController.js b/src/app/organization/organizationCollectionsAddController.js index d220044ec3..ce459eb029 100644 --- a/src/app/organization/organizationCollectionsAddController.js +++ b/src/app/organization/organizationCollectionsAddController.js @@ -75,9 +75,9 @@ if ($scope.useGroups) { collection.groupIds = []; - for (var id in $scope.selectedGroups) { - if ($scope.selectedGroups.hasOwnProperty(id)) { - collection.groupIds.push(id); + for (var groupId in $scope.selectedGroups) { + if ($scope.selectedGroups.hasOwnProperty(groupId)) { + collection.groupIds.push(groupId); } } } diff --git a/src/app/organization/organizationCollectionsEditController.js b/src/app/organization/organizationCollectionsEditController.js index 064308110b..7e35d9283e 100644 --- a/src/app/organization/organizationCollectionsEditController.js +++ b/src/app/organization/organizationCollectionsEditController.js @@ -88,14 +88,17 @@ if ($scope.useGroups) { collection.groupIds = []; - for (var id in $scope.selectedGroups) { - if ($scope.selectedGroups.hasOwnProperty(id)) { - collection.groupIds.push(id); + for (var groupId in $scope.selectedGroups) { + if ($scope.selectedGroups.hasOwnProperty(groupId)) { + collection.groupIds.push(groupId); } } } - $scope.submitPromise = apiService.collections.put({ orgId: $state.params.orgId }, collection, function (response) { + $scope.submitPromise = apiService.collections.put({ + orgId: $state.params.orgId, + id: id + }, collection, function (response) { $analytics.eventTrack('Edited Collection'); var decCollection = cipherService.decryptCollection(response, $state.params.orgId, true); $uibModalInstance.close(decCollection); diff --git a/src/app/organization/organizationGroupsEditController.js b/src/app/organization/organizationGroupsEditController.js index 41e77d0f70..b37540c87c 100644 --- a/src/app/organization/organizationGroupsEditController.js +++ b/src/app/organization/organizationGroupsEditController.js @@ -67,14 +67,17 @@ if (!group.accessAll) { group.collectionIds = []; - for (var id in $scope.selectedCollections) { - if ($scope.selectedCollections.hasOwnProperty(id)) { - group.collectionIds.push(id); + for (var collId in $scope.selectedCollections) { + if ($scope.selectedCollections.hasOwnProperty(collId)) { + group.collectionIds.push(collId); } } } - $scope.submitPromise = apiService.groups.put({ orgId: $state.params.orgId }, group, function (response) { + $scope.submitPromise = apiService.groups.put({ + orgId: $state.params.orgId, + id: id + }, group, function (response) { $analytics.eventTrack('Edited Group'); $uibModalInstance.close({ id: response.Id, diff --git a/src/app/organization/organizationPeopleEditController.js b/src/app/organization/organizationPeopleEditController.js index 242dca0232..d20e2fc23a 100644 --- a/src/app/organization/organizationPeopleEditController.js +++ b/src/app/organization/organizationPeopleEditController.js @@ -84,14 +84,18 @@ } } - $scope.submitPromise = apiService.organizationUsers.put({ orgId: $state.params.orgId, id: id }, { - type: $scope.type, - collections: collections, - accessAll: $scope.accessAll - }, function () { - $analytics.eventTrack('Edited User'); - $uibModalInstance.close(); - }).$promise; + $scope.submitPromise = apiService.organizationUsers.put( + { + orgId: $state.params.orgId, + id: id + }, { + type: $scope.type, + collections: collections, + accessAll: $scope.accessAll + }, function () { + $analytics.eventTrack('Edited User'); + $uibModalInstance.close(); + }).$promise; }; $scope.close = function () {