Skip to content

[PM-13428] Remove ownership option #1405

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ protocol AddEditItemState: Sendable {
/// The state for guided tour view.
var guidedTourViewState: GuidedTourViewState { get set }

/// Whether the user belongs to any organization.
var hasOrganizations: Bool { get }

/// The state for a identity type item.
var identityState: IdentityItemState { get set }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ struct AddEditItemView: View {
)
.accessibilityIdentifier("FolderPicker")

if store.state.configuration.isAdding, let owner = store.state.owner {
if store.state.configuration.isAdding, let owner = store.state.owner, store.state.hasOrganizations {
ContentBlock(dividerLeadingPadding: 16) {
BitwardenMenuField(
title: Localizations.owner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,12 @@ class AddEditItemViewTests: BitwardenTestCase { // swiftlint:disable:this type_b

@MainActor
func test_snapshot_add_personalOwnershipPolicy() {
processor.state.ownershipOptions.append(.organization(id: "1", name: "Organization"))
processor.state.owner = .organization(id: "1", name: "Organization")
processor.state.isPersonalOwnershipDisabled = true
processor.state.allUserCollections = [
.fixture(id: "1", name: "Default collection", organizationId: "1"),
]
assertSnapshot(of: subject.navStackWrapped, as: .defaultPortrait)
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions BitwardenShared/UI/Vault/VaultItem/CipherItemState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ struct CipherItemState: Equatable { // swiftlint:disable:this type_body_length
self
}

var hasOrganizations: Bool {
cipher.organizationId != nil || ownershipOptions.contains { !$0.isPersonal }
}
Comment on lines +140 to +142
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โ›๏ธ Add tests.


/// Whether or not this item can be assigned to collections.
var canAssignToCollection: Bool {
guard !collectionIds.isEmpty else { return true }
Expand Down
Loading