1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-13 23:13:36 +00:00

Addressing code review 3

This commit is contained in:
Jimmy Vo
2024-12-12 11:44:47 -05:00
parent 4cdea19d4d
commit d9d4b251a8

View File

@@ -273,9 +273,12 @@ export class MemberDialogComponent implements OnDestroy {
}
private setFormValidators(organization: Organization) {
const _orgSeatLimitReachedValidator = [
const emailsControlValidators = [
Validators.required,
commaSeparatedEmails,
inputEmailLimitValidator(organization, (maxEmailsCount: number) =>
this.i18nService.t("tooManyEmails", maxEmailsCount),
),
orgSeatLimitReachedValidator(
organization,
this.params.allOrganizationUserEmails,
@@ -283,17 +286,8 @@ export class MemberDialogComponent implements OnDestroy {
),
];
const _inputEmailLimitValidator = [
Validators.required,
commaSeparatedEmails,
inputEmailLimitValidator(organization, (maxEmailsCount: number) =>
this.i18nService.t("tooManyEmails", maxEmailsCount),
),
];
const emailsControl = this.formGroup.get("emails");
emailsControl.setValidators(_orgSeatLimitReachedValidator);
emailsControl.setValidators(_inputEmailLimitValidator);
emailsControl.setValidators(emailsControlValidators);
emailsControl.updateValueAndValidity();
}