From bae63ee705bf87a1841c7df19577bafa498f9f73 Mon Sep 17 00:00:00 2001 From: Brian O'Kelley Date: Sat, 10 Jan 2026 08:33:37 -0500 Subject: [PATCH] fix: exclude personal workspaces from Related Organizations duplicate detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Personal workspaces should not appear in "Related Organizations (Potential Duplicates)" since they represent individual users, not companies that could be merged. This change ensures: - Personal workspaces don't show the similar orgs section when viewed - Other organizations' duplicate detection is unchanged 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .changeset/jolly-houses-shake.md | 2 ++ server/src/routes/admin/accounts.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changeset/jolly-houses-shake.md diff --git a/.changeset/jolly-houses-shake.md b/.changeset/jolly-houses-shake.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/jolly-houses-shake.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/server/src/routes/admin/accounts.ts b/server/src/routes/admin/accounts.ts index f17b1a9a8a..bad4bcb38b 100644 --- a/server/src/routes/admin/accounts.ts +++ b/server/src/routes/admin/accounts.ts @@ -481,12 +481,14 @@ export function setupAccountRoutes( ), // Domain health: Similar organization names (potential duplicates) + // Skip for personal workspaces - they shouldn't have duplicates pool.query( ` WITH this_org AS ( SELECT workos_organization_id, name, + is_personal, LOWER(REGEXP_REPLACE( REGEXP_REPLACE(name, '\\s*(Inc\\.?|LLC|Corp\\.?|Ltd\\.?|Company|Co\\.?)\\s*$', '', 'i'), '[^a-z0-9\\s]', '', 'g' @@ -499,7 +501,6 @@ export function setupAccountRoutes( workos_organization_id, name, subscription_status, - is_personal, LOWER(REGEXP_REPLACE( REGEXP_REPLACE(name, '\\s*(Inc\\.?|LLC|Corp\\.?|Ltd\\.?|Company|Co\\.?)\\s*$', '', 'i'), '[^a-z0-9\\s]', '', 'g' @@ -520,6 +521,7 @@ export function setupAccountRoutes( OR t.normalized_name LIKE '%' || oo.normalized_name || '%' ) WHERE LENGTH(t.normalized_name) >= 3 + AND t.is_personal = false ORDER BY oo.name ASC `, [orgId]