🐛 (workspace) Fix members list limit bug
This commit is contained in:
@ -97,8 +97,7 @@ export const MembersList = () => {
|
||||
!isSeatsLimitReached({
|
||||
plan: workspace?.plan,
|
||||
customSeatsLimit: workspace?.customSeatsLimit,
|
||||
existingMembersCount: currentMembersCount,
|
||||
existingInvitationsCount: invitations.length,
|
||||
existingMembersAndInvitationsCount: currentMembersCount,
|
||||
})
|
||||
|
||||
return (
|
||||
|
@ -38,8 +38,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
])
|
||||
if (
|
||||
isSeatsLimitReached({
|
||||
existingMembersCount,
|
||||
existingInvitationsCount,
|
||||
existingMembersAndInvitationsCount:
|
||||
existingMembersCount + existingInvitationsCount,
|
||||
...workspace,
|
||||
})
|
||||
)
|
||||
|
@ -180,18 +180,15 @@ export const getSeatsLimit = ({
|
||||
}
|
||||
|
||||
export const isSeatsLimitReached = ({
|
||||
existingMembersCount,
|
||||
existingInvitationsCount,
|
||||
existingMembersAndInvitationsCount,
|
||||
plan,
|
||||
customSeatsLimit,
|
||||
}: { existingMembersCount: number; existingInvitationsCount: number } & Pick<
|
||||
Workspace,
|
||||
'plan' | 'customSeatsLimit'
|
||||
>) => {
|
||||
}: {
|
||||
existingMembersAndInvitationsCount: number
|
||||
} & Pick<Workspace, 'plan' | 'customSeatsLimit'>) => {
|
||||
const seatsLimit = getSeatsLimit({ plan, customSeatsLimit })
|
||||
return (
|
||||
seatsLimit !== infinity &&
|
||||
seatsLimit <= existingMembersCount + existingInvitationsCount
|
||||
seatsLimit !== infinity && seatsLimit <= existingMembersAndInvitationsCount
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user