1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-31 07:33:23 +00:00

stub out bulk share

This commit is contained in:
Kyle Spearrin
2018-06-13 00:03:48 -04:00
parent 3edf761549
commit e18f76d2b0
9 changed files with 203 additions and 29 deletions

View File

@@ -52,11 +52,11 @@ export class ShareComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.unselectAll();
this.selectAll(false);
}
filterCollections() {
this.unselectAll();
this.selectAll(false);
if (this.organizationId == null || this.writeableCollections.length === 0) {
this.collections = [];
} else {
@@ -77,17 +77,9 @@ export class ShareComponent implements OnInit, OnDestroy {
}
}
cipherView.organizationId = this.organizationId;
cipherView.collectionIds = [];
for (const collection of this.collections) {
if ((collection as any).checked) {
cipherView.collectionIds.push(collection.id);
}
}
const checkedCollectionIds = this.collections.filter((c) => (c as any).checked).map((c) => c.id);
this.formPromise = Promise.all(attachmentPromises).then(async () => {
const encCipher = await this.cipherService.encrypt(cipherView);
await this.cipherService.shareWithServer(encCipher);
await this.cipherService.shareWithServer(cipherView, this.organizationId, checkedCollectionIds);
this.onSharedCipher.emit();
this.analytics.eventTrack.next({ action: 'Shared Cipher' });
this.toasterService.popAsync('success', null, this.i18nService.t('sharedItem'));
@@ -99,15 +91,10 @@ export class ShareComponent implements OnInit, OnDestroy {
(c as any).checked = !(c as any).checked;
}
selectAll() {
for (const c of this.collections) {
(c as any).checked = true;
}
}
unselectAll() {
for (const c of this.writeableCollections) {
(c as any).checked = false;
selectAll(select: false) {
const collections = select ? this.collections : this.writeableCollections;
for (const c of collections) {
(c as any).checked = select;
}
}
}