Skip to content

Commit f05320a

Browse files
authored
Merge pull request #2864 from appwrite/feat-fix-members-invite-button
fix: members invite button disabled
2 parents bff7bc0 + 96fbfdc commit f05320a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • src/routes/(console)/organization-[organization]/members

src/routes/(console)/organization-[organization]/members/+page.svelte

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
import { base } from '$app/paths';
77
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
88
import Upgrade from '$lib/components/roles/upgrade.svelte';
9-
import { getRoleLabel } from '$lib/stores/billing';
9+
import { getServiceLimit, readOnly, getRoleLabel } from '$lib/stores/billing';
1010
import { addNotification } from '$lib/stores/notifications';
1111
import { currentPlan, newMemberModal, organization } from '$lib/stores/organization';
1212
import { isOwner } from '$lib/stores/roles';
1313
import { sdk } from '$lib/stores/sdk';
1414
import type { Models } from '@appwrite.io/console';
1515
import Delete from '../deleteMember.svelte';
1616
import Edit from './edit.svelte';
17-
import { isCloud } from '$lib/system';
17+
import { isCloud, GRACE_PERIOD_OVERRIDE } from '$lib/system';
1818
import {
1919
IconDotsHorizontal,
2020
IconInfo,
@@ -45,8 +45,10 @@
4545
// Calculate if button should be disabled and tooltip should show
4646
$: memberCount = data.organizationMembers?.total ?? 0;
4747
$: supportsMembers = $organization?.billingPlanDetails?.addons?.seats;
48-
$: isFreeWithMembers = !supportsMembers && memberCount >= 1;
49-
$: isButtonDisabled = isCloud ? isFreeWithMembers : false;
48+
$: limit = getServiceLimit('members', null, $currentPlan) || Infinity;
49+
$: isLimited = limit !== 0 && limit < Infinity;
50+
$: isButtonDisabled =
51+
isCloud && (($readOnly && !GRACE_PERIOD_OVERRIDE) || (isLimited && memberCount >= limit));
5052
5153
const resend = async (member: Models.Membership) => {
5254
try {

0 commit comments

Comments
 (0)