BIT-1704: Edit items in collection bug (#977)

This commit is contained in:
Ramsey Smith
2024-02-07 15:52:39 -07:00
committed by Álison Fernandes
parent 3266ed65c3
commit f7150d33cb
4 changed files with 182 additions and 3 deletions

View File

@@ -744,7 +744,11 @@ class VaultRepositoryImpl(
}
is UpdateCipherResponseJson.Success -> {
vaultDiskSource.saveCipher(userId = userId, cipher = response.cipher)
vaultDiskSource.saveCipher(
userId = userId,
cipher = response.cipher
.copy(collectionIds = cipherView.collectionIds),
)
UpdateCipherResult.Success
}
}

View File

@@ -114,6 +114,7 @@ fun VaultAddEditState.ViewState.appendFolderAndOwnerData(
),
availableOwners = activeAccount.toAvailableOwners(
collectionViewList = collectionViewList,
cipherView = currentContentState.common.originalCipher,
isIndividualVaultDisabled = isIndividualVaultDisabled,
),
),
@@ -165,6 +166,7 @@ private fun UserState.Account.toSelectedOwnerId(cipherView: CipherView?): String
private fun UserState.Account.toAvailableOwners(
collectionViewList: List<CollectionView>,
cipherView: CipherView?,
isIndividualVaultDisabled: Boolean,
): List<VaultAddEditState.Owner> =
listOfNotNull(
@@ -188,7 +190,9 @@ private fun UserState.Account.toAvailableOwners(
VaultCollection(
id = collection.id.orEmpty(),
name = collection.name,
isSelected = false,
isSelected = cipherView
?.collectionIds
?.contains(collection.id) == true,
)
},
)