Skip to content

Commit

Permalink
[AC-2500] Collection row menus - adjust feature flagging (#9116)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliykat committed May 13, 2024
1 parent 8e4073f commit 8c5841a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@
{{ "access" | i18n }}
</button>
</ng-container>
<ng-container
*ngIf="flexibleCollectionsV1Enabled && !canEditCollection && canViewCollectionInfo"
>
<ng-container *ngIf="!canEditCollection && canViewCollectionInfo">
<button type="button" bitMenuItem (click)="edit(true)">
<i class="bwi bwi-fw bwi-pencil-square" aria-hidden="true"></i>
{{ "viewInfo" | i18n }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class VaultItemsComponent {

protected canViewCollectionInfo(collection: CollectionView) {
const organization = this.allOrganizations.find((o) => o.id === collection.organizationId);
return collection.canViewCollectionInfo(organization);
return collection.canViewCollectionInfo(organization, this.flexibleCollectionsV1Enabled);
}

protected toggleAll() {
Expand Down
9 changes: 8 additions & 1 deletion apps/web/src/app/vault/core/views/collection-admin.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ export class CollectionAdminView extends CollectionView {
/**
* Returns true if the user can view collection info and access in a read-only state from the Admin Console
*/
override canViewCollectionInfo(org: Organization | undefined): boolean {
override canViewCollectionInfo(
org: Organization | undefined,
flexibleCollectionsV1Enabled: boolean,
): boolean {
if (!flexibleCollectionsV1Enabled) {
return false;
}

if (this.isUnassignedCollection) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
</bit-breadcrumbs>

<ng-container slot="title-suffix">
<ng-container *ngIf="collection != null && (canEditCollection || canDeleteCollection)">
<ng-container
*ngIf="
collection != null && (canEditCollection || canDeleteCollection || canViewCollectionInfo)
"
>
<button
bitIconButton="bwi-angle-down"
[bitMenuTriggerFor]="editCollectionMenu"
Expand All @@ -55,9 +59,7 @@
{{ "access" | i18n }}
</button>
</ng-container>
<ng-container
*ngIf="flexibleCollectionsV1Enabled && !canEditCollection && canViewCollectionInfo"
>
<ng-container *ngIf="!canEditCollection && canViewCollectionInfo">
<button
type="button"
bitMenuItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ export class VaultHeaderComponent implements OnInit {
}

get canViewCollectionInfo(): boolean {
return this.collection.node.canViewCollectionInfo(this.organization);
return this.collection.node.canViewCollectionInfo(
this.organization,
this.flexibleCollectionsV1Enabled,
);
}

get canCreateCollection(): boolean {
Expand Down
5 changes: 4 additions & 1 deletion libs/common/src/vault/models/view/collection.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ export class CollectionView implements View, ITreeNodeObject {
/**
* Returns true if the user can view collection info and access in a read-only state from the individual vault
*/
canViewCollectionInfo(org: Organization | undefined): boolean {
canViewCollectionInfo(
org: Organization | undefined,
flexibleCollectionsV1Enabled: boolean,
): boolean {
return false;
}

Expand Down

0 comments on commit 8c5841a

Please sign in to comment.