Skip to content

[dashboard] handle unlimited users condition in license page #9771

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

Merged
merged 1 commit into from
May 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions components/dashboard/src/admin/License.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function License() {
const features = license?.features;

// if user seats is 0, it means that there is no user limit in the license
const userLimit = license?.seats == 0 ? "Unlimited" : license?.seats;
const userLimit = license?.seats === 0 ? "Unlimited" : license?.seats;

const [licenseLevel, paid, statusMessage] = license ? getSubscriptionLevel(license) : defaultMessage();

Expand Down Expand Up @@ -155,7 +155,8 @@ function professionalPlan(userCount: number, seats: number, trial: boolean, vali
);
};

const aboveLimit: boolean = userCount > seats;
// seats === 0 means unlimited number of users
const aboveLimit: boolean = seats === 0 ? false : userCount > seats;

const licenseTitle = () => {
const expDate = new Date(validUntil);
Expand Down Expand Up @@ -202,7 +203,8 @@ function communityPlan(userCount: number, seats: number, fallbackAllowed: boolea
}
};

const aboveLimit: boolean = userCount > seats;
// seats === 0 means unlimited number of users
const aboveLimit: boolean = seats === 0 ? false : userCount > seats;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this could be de-duplicated as a single, isAboveLimit(userCount, seats) function. 💭 But not very important.


return [licenseLevel("Community"), additionalLicenseInfo("Free"), alertMessage(aboveLimit)];
}
Expand Down