mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-02 03:41:09 +01:00
Add collections to ciphers in export model. (#320)
* Add collections to ciphers in export model. This enables immediately setting collections from the CLI on create. The other location this code is used is on import of Bitwarden json data. However, collectionId is explicitly nulled out here to be resolved later at the server level. * Linter fix
This commit is contained in:
parent
b774c3e785
commit
08a856645b
@ -15,6 +15,7 @@ export class Cipher {
|
||||
static template(): Cipher {
|
||||
const req = new Cipher();
|
||||
req.organizationId = null;
|
||||
req.collectionIds = null;
|
||||
req.folderId = null;
|
||||
req.type = CipherType.Login;
|
||||
req.name = 'Item name';
|
||||
@ -34,6 +35,10 @@ export class Cipher {
|
||||
if (view.organizationId == null) {
|
||||
view.organizationId = req.organizationId;
|
||||
}
|
||||
if (view.collectionIds || req.collectionIds) {
|
||||
const set = new Set((view.collectionIds ?? []).concat(req.collectionIds ?? []));
|
||||
view.collectionIds = [...set];
|
||||
}
|
||||
view.name = req.name;
|
||||
view.notes = req.notes;
|
||||
view.favorite = req.favorite;
|
||||
@ -95,6 +100,7 @@ export class Cipher {
|
||||
type: CipherType;
|
||||
folderId: string;
|
||||
organizationId: string;
|
||||
collectionIds: string[];
|
||||
name: string;
|
||||
notes: string;
|
||||
favorite: boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user