fix: disable archived/read-only UI on self-hosted and correc… - #2319
Conversation
…t project status checks
ConsoleProject ID: Sites (2)
Note Appwrite has a Discord community with over 16 000 members. |
WalkthroughUpdates in src/routes/(console)/organization-[organization]/+page.svelte adjust project status handling and cloud gating:
Possibly related PRs
Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/routes/(console)/organization-[organization]/+page.svelte (3)
87-98: Command palette opens the wrong modal on CloudThe "Create project" command always toggles
showCreateinstead of delegating tohandleCreateProject, so on Cloud it will open the self-hosted dialog.Apply:
$: $registerCommands([ { label: 'Create project', - callback: () => { - showCreate = true; - }, + callback: handleCreateProject, keys: ['c'], disabled: projectCreationDisabled, group: 'projects', icon: IconPlus } ]);
142-163: Alert can show “0 projects are archived” when only plan limit is exceededCurrent logic uses
difference = projectsToArchive.lengtheven when thetotal > $currentPlan.projectsbranch triggers, yielding an incorrect title.Apply:
- {#if isCloud && $currentPlan?.projects && $currentPlan?.projects > 0 && data.organization.projects.length > 0 && $canWriteProjects && (projectsToArchive.length > 0 || data.projects.total > $currentPlan.projects)} - {@const difference = projectsToArchive.length} - {@const messagePrefix = - difference !== 1 ? `${difference} projects are` : `${difference} project is`} - <Alert.Inline title={`${messagePrefix} archived`}> - <Typography.Text>Upgrade your plan to restore archived projects</Typography.Text> - <svelte:fragment slot="actions"> - <Button - compact - size="s" - href={$upgradeURL} - on:click={() => { - trackEvent(Click.OrganizationClickUpgrade, { - from: 'button', - source: 'projects_archive_alert' - }); - }}> - Upgrade to Pro - </Button> - </svelte:fragment> - </Alert.Inline> - {/if} + {#if isCloud && $currentPlan?.projects && $currentPlan?.projects > 0 && data.organization.projects.length > 0 && $canWriteProjects} + {#if projectsToArchive.length > 0} + {@const difference = projectsToArchive.length} + {@const messagePrefix = difference !== 1 ? `${difference} projects are` : `${difference} project is`} + <Alert.Inline title={`${messagePrefix} archived`}> + <Typography.Text>Upgrade your plan to restore archived projects</Typography.Text> + <svelte:fragment slot="actions"> + <Button + compact + size="s" + href={$upgradeURL} + on:click={() => { + trackEvent(Click.OrganizationClickUpgrade, { + from: 'button', + source: 'projects_archive_alert' + }); + }}> + Upgrade to Pro + </Button> + </svelte:fragment> + </Alert.Inline> + {:else if data.projects.total > $currentPlan.projects} + <Alert.Inline title="You’ve reached your project limit"> + <Typography.Text>Upgrade your plan to create more projects</Typography.Text> + <svelte:fragment slot="actions"> + <Button + compact + size="s" + href={$upgradeURL} + on:click={() => { + trackEvent(Click.OrganizationClickUpgrade, { + from: 'button', + source: 'projects_limit_alert' + }); + }}> + Upgrade to Pro + </Button> + </svelte:fragment> + </Alert.Inline> + {/if} + {/if}
224-229: Possible runtime error if region not found
findRegionmay returnundefined, causingregion.nameaccess to throw. Add a safe fallback.Apply:
- <Typography.Text>{region.name}</Typography.Text> + <Typography.Text>{region?.name ?? project.region}</Typography.Text>
🧹 Nitpick comments (2)
src/routes/(console)/organization-[organization]/+page.svelte (2)
112-116: DRY up project lists using the same predicateUse
isSetToArchivefor both lists; it also implicitly handles non-cloud.Apply:
-$: projectsToArchive = isCloud - ? data.projects.projects.filter((project) => project.status === 'archived') - : []; - -$: activeProjects = data.projects.projects.filter((project) => project.status !== 'archived'); +$: projectsToArchive = data.projects.projects.filter((project) => isSetToArchive(project)); +$: activeProjects = data.projects.projects.filter((project) => !isSetToArchive(project));
195-205: Label mismatch: show “Archived” instead of “Set to archive”Since
isSetToArchiveis true only forstatus === 'archived', the tag text should reflect the actual state.Apply:
- }}>Set to archive</Tag> + }}>Archived</Tag>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/routes/(console)/organization-[organization]/+page.svelte(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: e2e
- GitHub Check: build
🔇 Additional comments (2)
src/routes/(console)/organization-[organization]/+page.svelte (2)
82-86: Cloud-only read-only gating looks correctScoping the read-only creation block to cloud aligns with the PR intent (self-hosted unaffected). LGTM.
106-110: Confirm archived-equivalent status values
isSetToArchivechecks onlyproject.status === 'archived', but the generated SDK types definestatusas a plain string. Verify the API spec (or server‐side enum) for any other transitional or archived‐equivalent values (e.g."archiving","deleted","inactive") to ensure they’re handled correctly.

…t project status checks
What does this PR do?
before


after
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)
Summary by CodeRabbit