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.selectedCollections = {};
|
||||||
$scope.collections = [];
|
$scope.collections = [];
|
||||||
|
|
||||||
|
var cipherAndCols = null;
|
||||||
$uibModalInstance.opened.then(function () {
|
$uibModalInstance.opened.then(function () {
|
||||||
apiService.ciphers.getDetails({ id: cipherId }).$promise.then(function (cipher) {
|
apiService.ciphers.getDetails({ id: cipherId }).$promise.then(function (cipher) {
|
||||||
$scope.loadingCipher = false;
|
$scope.loadingCipher = false;
|
||||||
@ -35,34 +36,40 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}).then(function (cipherAndCols) {
|
}).then(function (result) {
|
||||||
if (!cipherAndCols) {
|
if (!result) {
|
||||||
$scope.loadingCollections = false;
|
$scope.loadingCollections = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cipherAndCols = result;
|
||||||
|
return apiService.collections.listMe({ writeOnly: true }).$promise;
|
||||||
|
}).then(function (response) {
|
||||||
|
if (response === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
apiService.collections.listMe({ writeOnly: true }, function (response) {
|
var collections = [];
|
||||||
var collections = [];
|
var selectedCollections = {};
|
||||||
var selectedCollections = {};
|
var writeableCollections = response.Data;
|
||||||
|
|
||||||
for (var i = 0; i < response.Data.length; i++) {
|
for (var i = 0; i < writeableCollections.length; i++) {
|
||||||
// clean out selectCollections that aren't from this organization or read only
|
// clean out selectCollections that aren't from this organization
|
||||||
if (response.Data[i].Id in cipherAndCols.cipherCollections &&
|
if (writeableCollections[i].OrganizationId !== cipherAndCols.cipher.OrganizationId) {
|
||||||
response.Data[i].OrganizationId === cipherAndCols.cipher.OrganizationId) {
|
continue;
|
||||||
selectedCollections[response.Data[i].Id] = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var decCollection = cipherService.decryptCollection(response.Data[i]);
|
|
||||||
collections.push(decCollection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.loadingCollections = false;
|
if (writeableCollections[i].Id in cipherAndCols.cipherCollections) {
|
||||||
$scope.collections = collections;
|
selectedCollections[writeableCollections[i].Id] = true;
|
||||||
$scope.selectedCollections = selectedCollections;
|
}
|
||||||
});
|
|
||||||
|
var decCollection = cipherService.decryptCollection(writeableCollections[i]);
|
||||||
|
collections.push(decCollection);
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.loadingCollections = false;
|
||||||
|
$scope.collections = collections;
|
||||||
|
$scope.selectedCollections = selectedCollections;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user