Closed kristof-mattei closed 2 months ago
@kristof-mattei could you share what is resolved with this specific pr please?
That would make testing it a bit quicker and nice for reference.
@BlackDex absolutely, I must've hit the wrong button. It's supposed to be a draft.
@BlackDex there we go.
(sorry about hitting publish too soon).
This PR fixes a bug where moving a cipher from a personal vault to an organization does not attach the collection ids of which the cipher is now a member.
The front-end relies on these if the notification type is
NotificationType.SyncCipherUpdate
(https://github.com/bitwarden/clients/blob/91f1d9fb86142805d0774182c3ee6234e13946e3/libs/common/src/services/notifications.service.ts#L150) which in turn controlsisEdit
insyncUpsertCipher
(https://github.com/bitwarden/clients/blob/91f1d9fb86142805d0774182c3ee6234e13946e3/libs/common/src/vault/services/sync/sync.service.ts#L177). IfisEdit
istrue
(we moved a cipher, we didn't create one) we need thecollectionIds
otherwiseshouldUpdate
remainsfalse
(https://github.com/bitwarden/clients/blob/91f1d9fb86142805d0774182c3ee6234e13946e3/libs/common/src/vault/services/sync/sync.service.ts#L213).This causes a client on the receiving side to fail to properly update its view, requiring a manual refresh.
Before:
https://github.com/dani-garcia/vaultwarden/assets/864376/d2e0d455-2bd6-476f-823c-b357f0bd2f15
After:
https://github.com/dani-garcia/vaultwarden/assets/864376/8e08a0bd-9ea6-4bda-b1e8-67ab7e68514a
I chose
Option<Vec<String>>
because that's what the notifier service takes, even though technically we could doVec<String>
but that makes it much uglier for other consumers. Passing inNone
is much nicer thanvec![]
.