mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 21:33:27 +00:00
[PM-19368]Add new collection from individual vault is not displaying Upgrade option rather than Save (#13965)
* Resolve the pop up issue and update button * Rename a method properly
This commit is contained in:
@@ -13,6 +13,8 @@ import {
|
|||||||
Subject,
|
Subject,
|
||||||
switchMap,
|
switchMap,
|
||||||
takeUntil,
|
takeUntil,
|
||||||
|
tap,
|
||||||
|
filter,
|
||||||
} from "rxjs";
|
} from "rxjs";
|
||||||
import { first } from "rxjs/operators";
|
import { first } from "rxjs/operators";
|
||||||
|
|
||||||
@@ -189,12 +191,31 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
|||||||
this.formGroup.updateValueAndValidity();
|
this.formGroup.updateValueAndValidity();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.organizationSelected.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((_) => {
|
this.organizationSelected.valueChanges
|
||||||
|
.pipe(
|
||||||
|
tap((_) => {
|
||||||
|
if (this.organizationSelected.errors?.cannotCreateCollections) {
|
||||||
|
this.buttonDisplayName = ButtonType.Upgrade;
|
||||||
|
} else {
|
||||||
|
this.buttonDisplayName = ButtonType.Save;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
filter(() => this.organizationSelected.errors?.cannotCreateCollections),
|
||||||
|
switchMap((value) => this.findOrganizationById(value)),
|
||||||
|
takeUntil(this.destroy$),
|
||||||
|
)
|
||||||
|
.subscribe((org) => {
|
||||||
|
this.orgExceedingCollectionLimit = org;
|
||||||
this.organizationSelected.markAsTouched();
|
this.organizationSelected.markAsTouched();
|
||||||
this.formGroup.updateValueAndValidity();
|
this.formGroup.updateValueAndValidity();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async findOrganizationById(orgId: string): Promise<Organization | undefined> {
|
||||||
|
const organizations = await firstValueFrom(this.organizations$);
|
||||||
|
return organizations.find((org) => org.id === orgId);
|
||||||
|
}
|
||||||
|
|
||||||
async loadOrg(orgId: string) {
|
async loadOrg(orgId: string) {
|
||||||
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
|
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
|
||||||
const organization$ = this.organizationService
|
const organization$ = this.organizationService
|
||||||
|
|||||||
Reference in New Issue
Block a user