Fix email grouping to use registered domain instead of first subdomain#19
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.comto 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-> Contosouser@us.acme.org-> Acmealice@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
Test_ConvertMeetingsMembersToMarkdown_Big_sample:george.garcia@bookings.betasoft.comnow groups under Betasoft (14 members) instead of the separate Bookings group, consistent with the new logic.Test_ConvertMeetingMembersToMarkdown_SubdomainEmailGroupsByRegisteredDomain: verifies thatemea.contoso.comandcontoso.comboth group under Contoso.All 41 tests pass.