-
Notifications
You must be signed in to change notification settings - Fork 87
[PM-25993] Automatically select default collection on adding a new cipher #1973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PM-25993] Automatically select default collection on adding a new cipher #1973
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1973 +/- ##
=======================================
Coverage 81.27% 81.27%
=======================================
Files 822 822
Lines 51951 51956 +5
=======================================
+ Hits 42224 42229 +5
Misses 9727 9727 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditItemProcessorTests.swift
Show resolved
Hide resolved
BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditItemProcessorTests.swift
Outdated
Show resolved
Hide resolved
| @MainActor | ||
| func test_perform_fetchCipherOptions_defaultUserCollection() async { | ||
| let collections: [CollectionView] = [ | ||
| .fixture(id: "1", name: "Design", organizationId: "1", type: .defaultUserCollection), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 Would it make sense to have a test where the default collection is not the first item in the collections? As well, is it possible for there to be two collections both marked as default (as the data certainly seems to indicate)? Should we test/handle that scenario as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand there can be only one default user collection per organization. However, there could be multiple default user collections generally if the user belongs to multiple organizations. For this scenario in particular where a single organization is selected then only one default collection should be present or it would be wrongly configured server side and I think there isn't much we can do about it.
I will add another test thought to check that only the first one gets selected if by any chance multiple are present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree that the business rules shouldn't allow it—but the API does (something something "make illegal states unrepresentable"), so I feel like making sure we have a test for that circumstance is a good idea.
…tting the default collection not in the first item to reduce confusion.
🎟️ Tracking
PM-25993
📔 Objective
Automatically select default user collection when adding a new cipher if present.
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes