1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

addEditCipherInfo w/ collections from state

This commit is contained in:
Kyle Spearrin
2019-06-24 21:12:34 -04:00
parent bc5a6e02c1
commit 24ffb55ce0

View File

@@ -162,8 +162,13 @@ export class AddEditComponent implements OnInit {
this.title = this.i18nService.t('addItem'); this.title = this.i18nService.t('addItem');
} }
this.cipher = await this.stateService.get<CipherView>('addEditCipher'); const addEditCipherInfo: any = await this.stateService.get<any>('addEditCipherInfo');
await this.stateService.remove('addEditCipher'); if (addEditCipherInfo != null) {
this.cipher = addEditCipherInfo.cipher;
this.collectionIds = addEditCipherInfo.collectionIds;
}
await this.stateService.remove('addEditCipherInfo');
if (this.cipher == null) { if (this.cipher == null) {
if (this.editMode) { if (this.editMode) {
const cipher = await this.loadCipher(); const cipher = await this.loadCipher();
@@ -179,7 +184,10 @@ export class AddEditComponent implements OnInit {
this.cipher.identity = new IdentityView(); this.cipher.identity = new IdentityView();
this.cipher.secureNote = new SecureNoteView(); this.cipher.secureNote = new SecureNoteView();
this.cipher.secureNote.type = SecureNoteType.Generic; this.cipher.secureNote.type = SecureNoteType.Generic;
}
}
if (this.cipher != null && (!this.editMode || addEditCipherInfo != null)) {
await this.organizationChanged(); await this.organizationChanged();
if (this.collectionIds != null && this.collectionIds.length > 0 && this.collections.length > 0) { if (this.collectionIds != null && this.collectionIds.length > 0 && this.collections.length > 0) {
this.collections.forEach((c) => { this.collections.forEach((c) => {
@@ -189,7 +197,6 @@ export class AddEditComponent implements OnInit {
}); });
} }
} }
}
this.folders = await this.folderService.getAllDecrypted(); this.folders = await this.folderService.getAllDecrypted();
} }