Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/block-gmail-corp-domain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

Fix domain health page to exclude free email providers (gmail.com, etc.) from "Related Organizations" section
6 changes: 4 additions & 2 deletions server/src/routes/admin/domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,8 @@ export function setupDomainRoutes(
SUBSTRING(domain FROM '([^.]+\\.[^.]+)$') as root_domain
FROM org_domains
WHERE domain IS NOT NULL
-- Exclude personal email domains (gmail.com, yahoo.com, admin-managed domains, etc.)
AND LOWER(SUBSTRING(domain FROM '([^.]+\\.[^.]+)$')) NOT IN (${freeEmailPlaceholders})
),
root_groups AS (
-- Group by root domain, only keep groups with multiple orgs
Expand All @@ -1461,8 +1463,8 @@ export function setupDomainRoutes(
)
SELECT * FROM root_groups
ORDER BY org_count DESC
LIMIT $1
`, [limit]);
LIMIT $${allExcludedDomains.length + 1}
`, [...allExcludedDomains, limit]);

// 7. Similar organization names - find orgs with similar names that might be duplicates
// Uses trigram similarity (requires pg_trgm extension) or simple word matching
Expand Down