From 5b96cc9dea508c2a6905e58fbf01dcbdce916946 Mon Sep 17 00:00:00 2001 From: Sergio Visinoni Date: Thu, 23 Apr 2026 11:18:03 +0200 Subject: [PATCH 1/2] fix: fix startup script R2 buckets are managed transparently in the local environment without the need to explicly create them. --- scripts/start-local-environment.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/start-local-environment.sh b/scripts/start-local-environment.sh index a8274028..e35bf34c 100755 --- a/scripts/start-local-environment.sh +++ b/scripts/start-local-environment.sh @@ -150,14 +150,8 @@ fi echo "🔨 Building worker..." worker-build --release --quiet -# Create R2 bucket for logos (if it doesn't exist) -echo "🪣 Setting up R2 assets bucket..." -if ! wrangler r2 bucket list | grep -q "rushomon-assets"; then - echo "Creating R2 bucket: rushomon-assets" - wrangler r2 bucket create rushomon-assets -else - echo "R2 bucket 'rushomon-assets' already exists" -fi +# Note: R2 bucket is created automatically by wrangler dev --local +# Remote bucket creation is skipped for local development # Apply migrations (passing environment if specified) echo "🔨 Applying migrations..." From 8357b659671c974d6b7fa5ebd9ac1b00e472ab45 Mon Sep 17 00:00:00 2001 From: Sergio Visinoni Date: Thu, 23 Apr 2026 11:19:22 +0200 Subject: [PATCH 2/2] fix: Fix organization deletion modal link count The modal was showing billing account-level link creation count instead of the actual number of links in the specific organization being deleted. Additionally, skip the modal entirely if the organization has 0 links. - Add link_count to /api/orgs/{id} endpoint response - Update OrgDetails TypeScript interface to include link_count - Use org-specific link count instead of billing account count in deletion modal - Skip modal and delete directly when organization has 0 links --- frontend/src/lib/types/api.ts | 1 + frontend/src/routes/dashboard/org/+page.svelte | 14 ++++++++++---- src/api/orgs/crud.rs | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/frontend/src/lib/types/api.ts b/frontend/src/lib/types/api.ts index 2790581d..0bb968f3 100644 --- a/frontend/src/lib/types/api.ts +++ b/frontend/src/lib/types/api.ts @@ -310,6 +310,7 @@ export interface OrgDetails { created_at: number; role: "owner" | "member"; logo_url: string | null; + link_count: number; }; members: OrgMember[]; pending_invitations: OrgInvitation[]; diff --git a/frontend/src/routes/dashboard/org/+page.svelte b/frontend/src/routes/dashboard/org/+page.svelte index bf8aa6fc..39988bb0 100644 --- a/frontend/src/routes/dashboard/org/+page.svelte +++ b/frontend/src/routes/dashboard/org/+page.svelte @@ -356,16 +356,14 @@ let canDelete = $state(false); async function checkCanDelete() { - if (!orgDetails) return; try { const orgsRes = await orgsApi.listMyOrgs(); const ownedOrgs = orgsRes.orgs.filter((o) => o.role === "owner"); userOrgs = ownedOrgs.filter((o) => o.id !== orgDetails!.org.id); canDelete = ownedOrgs.length > 1; - // Get link count from usage API - const usage = await orgsApi.getUsage(); - linkCount = usage.usage?.links_created_this_month || 0; + // Get link count from org details (actual links in this org, not billing account level) + linkCount = orgDetails?.org.link_count || 0; } catch { canDelete = false; } @@ -378,6 +376,14 @@ setTimeout(() => (actionError = ""), 3000); return; } + + // If org has no links, delete directly without showing modal + if (linkCount === 0) { + deleteAction = "delete"; + await handleDeleteOrg(); + return; + } + showDeleteModal = true; deleteError = ""; deleteAction = "delete"; diff --git a/src/api/orgs/crud.rs b/src/api/orgs/crud.rs index c17ff14c..8bf24080 100644 --- a/src/api/orgs/crud.rs +++ b/src/api/orgs/crud.rs @@ -148,6 +148,7 @@ async fn inner_get_org(req: Request, ctx: RouteContext<()>) -> Result) -> Result