mirror of
https://github.com/bitwarden/browser
synced 2025-01-14 03:19:54 +01:00
Roll back organizationId and collectionId's if ciphers fail to be moved (#699)
This commit is contained in:
parent
e47eb5e74f
commit
8f5f694a1e
@ -657,7 +657,15 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
}
|
||||
await Promise.all(promises);
|
||||
const request = new CipherBulkShareRequest(encCiphers, collectionIds);
|
||||
await this.apiService.putShareCiphers(request);
|
||||
try {
|
||||
await this.apiService.putShareCiphers(request);
|
||||
} catch (e) {
|
||||
for (const cipher of ciphers) {
|
||||
cipher.organizationId = null;
|
||||
cipher.collectionIds = null;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
const userId = await this.stateService.getUserId();
|
||||
await this.upsert(encCiphers.map((c) => c.toCipherData(userId)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user