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