[PR #4517] [MERGED] Pass in collection ids to notifier when sharing cipher. #7084

Closed
opened 2026-03-07 21:10:45 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/4517
Author: @kristof-mattei
Created: 4/19/2024
Status: Merged
Merged: 4/27/2024
Merged by: @dani-garcia

Base: mainHead: share-to-org-notification


📝 Commits (1)

  • df1bbc5 Pass in collection ids to notifier when sharing cipher.

📊 Changes

3 files changed (+19 additions, -12 deletions)

View changed files

📝 src/api/core/accounts.rs (+1 -1)
📝 src/api/core/ciphers.rs (+17 -10)
📝 src/api/core/organizations.rs (+1 -1)

📄 Description

(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 (91f1d9fb86/libs/common/src/services/notifications.service.ts (L150)) which in turn controls isEdit in syncUpsertCipher (91f1d9fb86/libs/common/src/vault/services/sync/sync.service.ts (L177)). If isEdit is true (we moved a cipher, we didn't create one) we need the collectionIds otherwise shouldUpdate remains false (91f1d9fb86/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 do Vec<String> but that makes it much uglier for other consumers. Passing in None is much nicer than vec![].


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/4517 **Author:** [@kristof-mattei](https://github.com/kristof-mattei) **Created:** 4/19/2024 **Status:** ✅ Merged **Merged:** 4/27/2024 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `main` ← **Head:** `share-to-org-notification` --- ### 📝 Commits (1) - [`df1bbc5`](https://github.com/dani-garcia/vaultwarden/commit/df1bbc58644fa40c34ca68973903560d7e45d338) Pass in collection ids to notifier when sharing cipher. ### 📊 Changes **3 files changed** (+19 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src/api/core/accounts.rs` (+1 -1) 📝 `src/api/core/ciphers.rs` (+17 -10) 📝 `src/api/core/organizations.rs` (+1 -1) </details> ### 📄 Description (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 controls `isEdit` in `syncUpsertCipher` (https://github.com/bitwarden/clients/blob/91f1d9fb86142805d0774182c3ee6234e13946e3/libs/common/src/vault/services/sync/sync.service.ts#L177). If `isEdit` is `true` (we moved a cipher, we didn't create one) we need the `collectionIds` otherwise `shouldUpdate` remains `false` (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 do `Vec<String>` but that makes it much uglier for other consumers. Passing in `None` is much nicer than `vec![]`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-07 21:10:45 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vaultwarden#7084