Skip to content

Conversation

vermakhushboo
Copy link
Member

@vermakhushboo vermakhushboo commented Sep 12, 2025

What does this PR do?

Check domainsList for cloud only

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
    • Domain verification now correctly differentiates Cloud and self‑hosted environments, avoiding unintended domain creation/update attempts outside Cloud.
    • Consistent behavior applied across Functions, Project Settings, and Sites domain verification pages.
    • Preserves existing success messaging and navigation while preventing misleading flows in non‑Cloud contexts.

Copy link

appwrite bot commented Sep 12, 2025

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

You can use Avatars API to generate QR code for any text or URLs.

Copy link
Contributor

coderabbitai bot commented Sep 12, 2025

Walkthrough

Three Svelte pages updated to make isNewDomain conditional on isCloud:

  • functions/.../domains/add-domain/verify-[domain]/+page.svelte
  • settings/.../domains/add-domain/verify-[domain]/+page.svelte
  • sites/.../domains/add-domain/verify-[domain]/+page.svelte

Logic change: isNewDomain is computed as isCloud ? (domain not found in data.domainsList.domains) : true. In non-cloud contexts, isNewDomain defaults to true, but creation/update branches remain gated by isCloud and do not run when false. Verification flow, success handling, and error handling remain unchanged. No exported/public declarations were modified.

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Check for domainsList only for cloud" accurately and concisely describes the primary change: domainsList existence checks are now gated by isCloud, altering behavior for non‑cloud/self‑hosted contexts; it is specific, focused, and readable for someone scanning PR history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-domain-check-for-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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 (1)
src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/verify-[domain]/+page.svelte (1)

63-65: Unreachable success path: unconditional throws always error out

Both branches throw regardless of verification result, so the success notification/redirect never execute.

-                verified = ruleData.status === 'verified';
-                throw new Error(
-                    'Domain verification failed. Please check your domain settings or try again later'
-                );
+                verified = ruleData.status === 'verified';
+                if (!verified) {
+                    throw new Error(
+                        'Domain verification failed. Please check your domain settings or try again later'
+                    );
+                }
@@
-                verified = domainData.nameservers.toLowerCase() === 'appwrite';
-                throw new Error(
-                    'Domain verification failed. Please check your domain settings or try again later'
-                );
+                verified = domainData.nameservers.toLowerCase() === 'appwrite';
+                if (!verified) {
+                    throw new Error(
+                        'Domain verification failed. Please check your domain settings or try again later'
+                    );
+                }

Also applies to: 72-74

🧹 Nitpick comments (3)
src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/verify-[domain]/+page.svelte (1)

53-56: Cloud-only domainsList check: OK; make comparison case-insensitive and align across pages

Domains are case-insensitive. Prefer .some() with lowercase to match other files and avoid duplicates.

-        const isNewDomain = isCloud
-            ? data.domainsList.domains.findIndex((rule) => rule.domain === page.params.domain) ===
-              -1
-            : true;
+        const isNewDomain = isCloud
+            ? !data.domainsList.domains.some(
+                  (rule) =>
+                      rule.domain.toLowerCase() === page.params.domain.toLowerCase()
+              )
+            : true;
src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/add-domain/verify-[domain]/+page.svelte (1)

52-55: Cloud-only domainsList check: consider case-insensitive .some() for consistency

Prevents case-related mismatches and matches the approach used elsewhere.

-        const isNewDomain = isCloud
-            ? data.domainsList.domains.find((rule) => rule.domain === page.params.domain) ===
-              undefined
-            : true;
+        const isNewDomain = isCloud
+            ? !data.domainsList.domains.some(
+                  (rule) =>
+                      rule.domain.toLowerCase() === page.params.domain.toLowerCase()
+              )
+            : true;
src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/verify-[domain]/+page.svelte (1)

53-56: Cloud-only domainsList check: normalize to lowercase and use .some()

Tiny consistency/readability improvement and avoids case collisions.

-        const isNewDomain = isCloud
-            ? data.domainsList.domains.find((rule) => rule.domain === page.params.domain) ===
-              undefined
-            : true;
+        const isNewDomain = isCloud
+            ? !data.domainsList.domains.some(
+                  (rule) =>
+                      rule.domain.toLowerCase() === page.params.domain.toLowerCase()
+              )
+            : true;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between caf58bc and 8d37a96.

📒 Files selected for processing (3)
  • src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/add-domain/verify-[domain]/+page.svelte (1 hunks)
  • src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/verify-[domain]/+page.svelte (1 hunks)
  • src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/verify-[domain]/+page.svelte (1 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: build
  • GitHub Check: e2e

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.

1 participant