Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
addEditCipherInfo w/ collections from state
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Jun 25, 2019
1 parent bc5a6e0 commit 24ffb55
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/angular/components/add-edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,13 @@ export class AddEditComponent implements OnInit {
this.title = this.i18nService.t('addItem');
}

this.cipher = await this.stateService.get<CipherView>('addEditCipher');
await this.stateService.remove('addEditCipher');
const addEditCipherInfo: any = await this.stateService.get<any>('addEditCipherInfo');
if (addEditCipherInfo != null) {
this.cipher = addEditCipherInfo.cipher;
this.collectionIds = addEditCipherInfo.collectionIds;
}
await this.stateService.remove('addEditCipherInfo');

if (this.cipher == null) {
if (this.editMode) {
const cipher = await this.loadCipher();
Expand All @@ -179,15 +184,17 @@ export class AddEditComponent implements OnInit {
this.cipher.identity = new IdentityView();
this.cipher.secureNote = new SecureNoteView();
this.cipher.secureNote.type = SecureNoteType.Generic;
}
}

await this.organizationChanged();
if (this.collectionIds != null && this.collectionIds.length > 0 && this.collections.length > 0) {
this.collections.forEach((c) => {
if (this.collectionIds.indexOf(c.id) > -1) {
(c as any).checked = true;
}
});
}
if (this.cipher != null && (!this.editMode || addEditCipherInfo != null)) {
await this.organizationChanged();
if (this.collectionIds != null && this.collectionIds.length > 0 && this.collections.length > 0) {
this.collections.forEach((c) => {
if (this.collectionIds.indexOf(c.id) > -1) {
(c as any).checked = true;
}
});
}
}

Expand Down

0 comments on commit 24ffb55

Please sign in to comment.