Skip to content

fix: disable archived/read-only UI on self-hosted and correc… - #2319

Merged
Meldiron merged 1 commit into
mainfrom
fix-projects-going-archiive-self-hosted
Sep 3, 2025
Merged

fix: disable archived/read-only UI on self-hosted and correc…#2319
Meldiron merged 1 commit into
mainfrom
fix-projects-going-archiive-self-hosted

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Sep 3, 2025

Copy link
Copy Markdown
Member

…t project status checks

What does this PR do?

before
image
after
image

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

  • Bug Fixes
    • Project creation is no longer blocked outside cloud environments.
    • Archive actions and visibility now apply only in cloud and only for truly archived projects.
    • Active projects list correctly shows all non-archived projects.
    • Archived projects list now only appears in cloud and shows only archived projects.

@appwrite

appwrite Bot commented Sep 3, 2025

Copy link
Copy Markdown

Console

Project ID: 688b7bf400350cbd60e9

Sites (2)
Site Status Logs Preview QR
 console-qa
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code
 console-cloud
688b7c18002b9b871a8f
Ready Ready View Logs Preview URL QR Code

Note

Appwrite has a Discord community with over 16 000 members.

@coderabbitai

coderabbitai Bot commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Updates in src/routes/(console)/organization-[organization]/+page.svelte adjust project status handling and cloud gating:

  • projectCreationDisabled read-only check now applies only in cloud environments.
  • isSetToArchive(project) returns true only when project.status is 'archived', guarded by cloud context and valid project checks.
  • projectsToArchive now lists archived projects only when isCloud is true; otherwise returns empty.
  • activeProjects now includes projects with status not equal to 'archived'.
  • Archiving-related gating and visibility apply exclusively in cloud contexts.

Possibly related PRs

Suggested reviewers

  • lohanidamodar
  • ItzNotABug
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-projects-going-archiive-self-hosted

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Cloud

The "Create project" command always toggles showCreate instead of delegating to handleCreateProject, 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 exceeded

Current logic uses difference = projectsToArchive.length even when the total > $currentPlan.projects branch 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

findRegion may return undefined, causing region.name access 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 predicate

Use isSetToArchive for 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 isSetToArchive is true only for status === '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.

📥 Commits

Reviewing files that changed from the base of the PR and between 905f8bc and bda2c4f.

📒 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 correct

Scoping the read-only creation block to cloud aligns with the PR intent (self-hosted unaffected). LGTM.


106-110: Confirm archived-equivalent status values
isSetToArchive checks only project.status === 'archived', but the generated SDK types define status as 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.

@Meldiron
Meldiron merged commit 43e22d8 into main Sep 3, 2025
5 checks passed
@Meldiron
Meldiron deleted the fix-projects-going-archiive-self-hosted branch September 3, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants