From 933fb36a9308cf239919a280461850e39b419cba Mon Sep 17 00:00:00 2001 From: Jimmy Vo Date: Thu, 5 Dec 2024 12:23:04 -0500 Subject: [PATCH] Remove unreachable toast logic. --- .../member-dialog/member-dialog.component.ts | 22 ++++++++++--------- .../members/members.component.ts | 2 +- apps/web/src/locales/en/messages.json | 8 ++++++- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts index 53ac8164f59..c3b1c05a53c 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts @@ -284,16 +284,27 @@ export class MemberDialogComponent implements OnDestroy { orgSeatLimitReachedValidator( organization, this.params.allOrganizationUserEmails, - this.i18nService.t("subscriptionUpgrade", organization.seats), + this.getSeatLimitErrorMessageForPlan(organization), this.params.occupiedSeatCount, ), ]; + const emailsControl = this.formGroup.get("emails"); emailsControl.setValidators(emailsControlValidators); emailsControl.updateValueAndValidity(); } } + private getSeatLimitErrorMessageForPlan(organization: Organization): string { + const { seats, hasReseller } = organization; + + if (hasReseller) { + return this.i18nService.t("seatLimitReachedContactYourProvider", seats); + } + + return this.i18nService.t("subscriptionUpgrade", seats); + } + private loadOrganizationUser( userDetails: OrganizationUserAdminView, groups: GroupDetailsView[], @@ -467,15 +478,6 @@ export class MemberDialogComponent implements OnDestroy { }); return; } - if ( - organization.hasReseller && - this.params.numConfirmedMembers + emails.length > organization.seats - ) { - this.formGroup.controls.emails.setErrors({ - tooManyEmails: { message: this.i18nService.t("seatLimitReachedContactYourProvider") }, - }); - return; - } await this.userService.invite(emails, userView); } diff --git a/apps/web/src/app/admin-console/organizations/members/members.component.ts b/apps/web/src/app/admin-console/organizations/members/members.component.ts index a0e0e191478..5b8e4508323 100644 --- a/apps/web/src/app/admin-console/organizations/members/members.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/members.component.ts @@ -467,7 +467,7 @@ export class MembersComponent extends BaseMembersComponent if ( !user && this.organization.hasReseller && - this.organization.seats === this.dataSource.confirmedUserCount + this.organization.seats === this.dataSource.occupiedSeatCount ) { this.toastService.showToast({ variant: "error", diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index eb98a1d7577..1f21b1d6e26 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -8519,7 +8519,13 @@ "message": "Contact your provider to purchase additional seats." }, "seatLimitReachedContactYourProvider": { - "message": "Seat limit has been reached. Contact your provider to purchase additional seats." + "message": "Seat limit of $COUNT$ has been reached. Contact your provider to purchase additional seats.", + "placeholders": { + "count": { + "content": "$1", + "example": "2" + } + } }, "collectionAccessRestricted": { "message": "Collection access is restricted"