mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-06 09:20:43 +01:00
fix bug with only showing selected collections
This commit is contained in:
parent
1eb5a99ba3
commit
c3653577c6
@ -11,6 +11,7 @@
|
||||
$scope.selectedCollections = {};
|
||||
$scope.collections = [];
|
||||
|
||||
var cipherAndCols = null;
|
||||
$uibModalInstance.opened.then(function () {
|
||||
apiService.ciphers.getDetails({ id: cipherId }).$promise.then(function (cipher) {
|
||||
$scope.loadingCipher = false;
|
||||
@ -35,27 +36,34 @@
|
||||
}
|
||||
|
||||
return null;
|
||||
}).then(function (cipherAndCols) {
|
||||
if (!cipherAndCols) {
|
||||
}).then(function (result) {
|
||||
if (!result) {
|
||||
$scope.loadingCollections = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
cipherAndCols = result;
|
||||
return apiService.collections.listMe({ writeOnly: true }).$promise;
|
||||
}).then(function (response) {
|
||||
if (response === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiService.collections.listMe({ writeOnly: true }, function (response) {
|
||||
var collections = [];
|
||||
var selectedCollections = {};
|
||||
var writeableCollections = response.Data;
|
||||
|
||||
for (var i = 0; i < response.Data.length; i++) {
|
||||
// clean out selectCollections that aren't from this organization or read only
|
||||
if (response.Data[i].Id in cipherAndCols.cipherCollections &&
|
||||
response.Data[i].OrganizationId === cipherAndCols.cipher.OrganizationId) {
|
||||
selectedCollections[response.Data[i].Id] = true;
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < writeableCollections.length; i++) {
|
||||
// clean out selectCollections that aren't from this organization
|
||||
if (writeableCollections[i].OrganizationId !== cipherAndCols.cipher.OrganizationId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var decCollection = cipherService.decryptCollection(response.Data[i]);
|
||||
if (writeableCollections[i].Id in cipherAndCols.cipherCollections) {
|
||||
selectedCollections[writeableCollections[i].Id] = true;
|
||||
}
|
||||
|
||||
var decCollection = cipherService.decryptCollection(writeableCollections[i]);
|
||||
collections.push(decCollection);
|
||||
}
|
||||
|
||||
@ -64,7 +72,6 @@
|
||||
$scope.selectedCollections = selectedCollections;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$scope.toggleCollectionSelectionAll = function ($event) {
|
||||
var collections = {};
|
||||
|
Loading…
Reference in New Issue
Block a user