From 6bda5d5983b5c552b4d5a2c2a345f8c20f6fe068 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 11 May 2017 14:52:51 -0400 Subject: [PATCH] collection user refactor --- .../organizationCollectionsUsersController.js | 32 +++++++++++-------- .../views/organizationCollectionsUsers.html | 4 +-- src/app/services/apiService.js | 9 ++---- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/app/organization/organizationCollectionsUsersController.js b/src/app/organization/organizationCollectionsUsersController.js index 004d52dd6e..7b230671df 100644 --- a/src/app/organization/organizationCollectionsUsersController.js +++ b/src/app/organization/organizationCollectionsUsersController.js @@ -10,18 +10,17 @@ $uibModalInstance.opened.then(function () { $scope.loading = false; - apiService.collectionUsers.listCollection( + apiService.collections.listUsers( { orgId: $state.params.orgId, - collectionId: collection.id + id: collection.id }, function (userList) { if (userList && userList.Data.length) { var users = []; for (var i = 0; i < userList.Data.length; i++) { users.push({ - id: userList.Data[i].Id, - userId: userList.Data[i].UserId, + organizationUserId: userList.Data[i].OrganizationUserId, name: userList.Data[i].Name, email: userList.Data[i].Email, type: userList.Data[i].Type, @@ -41,16 +40,21 @@ return; } - apiService.collectionUsers.del({ orgId: $state.params.orgId, id: user.id }, null, function () { - toastr.success(user.email + ' has been removed.', 'User Removed'); - $analytics.eventTrack('Removed User From Collection'); - var index = $scope.users.indexOf(user); - if (index > -1) { - $scope.users.splice(index, 1); - } - }, function () { - toastr.error('Unable to remove user.', 'Error'); - }); + apiService.collections.delUser( + { + orgId: $state.params.orgId, + id: collection.id, + orgUserId: user.organizationUserId + }, null, function () { + toastr.success(user.email + ' has been removed.', 'User Removed'); + $analytics.eventTrack('Removed User From Collection'); + var index = $scope.users.indexOf(user); + if (index > -1) { + $scope.users.splice(index, 1); + } + }, function () { + toastr.error('Unable to remove user.', 'Error'); + }); }; $scope.close = function () { diff --git a/src/app/organization/views/organizationCollectionsUsers.html b/src/app/organization/views/organizationCollectionsUsers.html index aaba7f52ef..d1a405077e 100644 --- a/src/app/organization/views/organizationCollectionsUsers.html +++ b/src/app/organization/views/organizationCollectionsUsers.html @@ -22,12 +22,12 @@