mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +00:00
[PM-17213] - allow changing of item owner from personal to org (#13034)
* allow changing of item owner from personal to org * avoid unecessary api calls when updating item parent * move comment up a line * add localData to cipher instance
This commit is contained in:
@@ -63,8 +63,16 @@ export class DefaultCipherFormService implements CipherFormService {
|
||||
const originalCollectionIds = new Set(config.originalCipher.collectionIds ?? []);
|
||||
const newCollectionIds = new Set(cipher.collectionIds ?? []);
|
||||
|
||||
// If the collectionIds are the same, update the cipher normally
|
||||
if (isSetEqual(originalCollectionIds, newCollectionIds)) {
|
||||
// Call shareWithServer if the owner is changing from a user to an organization
|
||||
if (config.originalCipher.organizationId === null && cipher.organizationId != null) {
|
||||
savedCipher = await this.cipherService.shareWithServer(
|
||||
cipher,
|
||||
cipher.organizationId,
|
||||
cipher.collectionIds,
|
||||
activeUserId,
|
||||
);
|
||||
// If the collectionIds are the same, update the cipher normally
|
||||
} else if (isSetEqual(originalCollectionIds, newCollectionIds)) {
|
||||
savedCipher = await this.cipherService.updateWithServer(encryptedCipher, config.admin);
|
||||
} else {
|
||||
// Updating a cipher with collection changes is not supported with a single request currently
|
||||
|
||||
Reference in New Issue
Block a user