Skip to content

Fix email grouping to use registered domain instead of first subdomain#19

Merged
rulasg merged 1 commit into
mainfrom
rulasg/fix-email-domain-grouping
May 27, 2026
Merged

Fix email grouping to use registered domain instead of first subdomain#19
rulasg merged 1 commit into
mainfrom
rulasg/fix-email-domain-grouping

Conversation

@rulasg
Copy link
Copy Markdown
Owner

@rulasg rulasg commented May 27, 2026

Why

When grouping meeting members by company, the code was extracting the company name from the first segment of the email domain. This caused me@emea.contoso.com to be grouped under "Emea" instead of the correct "Contoso" -- a regional subdomain was being mistaken for the company identity.

What changed

The company name is now extracted from the second-to-last segment of the domain (the registered domain name, immediately before the TLD), which correctly reflects the user's organizational identity regardless of any subdomain prefix.

  • me@emea.contoso.com -> Contoso
  • user@us.acme.org -> Acme
  • alice@alphatech.com -> Alphatech (unchanged for simple domains)

The fix is applied in both email-parsing code paths inside parseMemberEmail (named format and plain email format).

Tests

  • Updated Test_ConvertMeetingsMembersToMarkdown_Big_sample: george.garcia@bookings.betasoft.com now groups under Betasoft (14 members) instead of the separate Bookings group, consistent with the new logic.
  • Added Test_ConvertMeetingMembersToMarkdown_SubdomainEmailGroupsByRegisteredDomain: verifies that emea.contoso.com and contoso.com both group under Contoso.

All 41 tests pass.

…ubdomain

emea.contoso.com now correctly groups under 'Contoso' instead of 'Emea'.
The company is now extracted from the second-to-last domain segment (the
registered domain before the TLD), matching the user's registered identity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rulasg rulasg merged commit d79e7c2 into main May 27, 2026
1 check passed
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