Skip to content

fix(gmail): fallback to send-as list for display name#184

Open
salmonumbrella wants to merge 3 commits intosteipete:mainfrom
salmonumbrella:fix/issue-182-gmail-from-display-name
Open

fix(gmail): fallback to send-as list for display name#184
salmonumbrella wants to merge 3 commits intosteipete:mainfrom
salmonumbrella:fix/issue-182-gmail-from-display-name

Conversation

@salmonumbrella
Copy link
Contributor

Summary

  • When SendAs.Get returns an empty display name, fall back to querying the SendAs.List endpoint to retrieve it
  • Applies to both the --from alias path and the default primary-account path
  • Extracted helper functions: primarySendAsDisplayName, sendAsDisplayNameFromList, primarySendAsDisplayNameFromList
  • Removed dead code branch in primarySendAsDisplayNameFromList

Fixes #182

Test plan

  • Existing TestGmailSendCmd_RunJSON_WithFrom still passes (Get returns display name directly)
  • Existing TestGmailSendCmd_RunJSON_PrimaryAccountDisplayName still passes
  • New TestGmailSendCmd_RunJSON_PrimaryAccountDisplayNameFallbackToList — primary account path falls back to List
  • New TestGmailSendCmd_RunJSON_WithFromDisplayNameFallbackToList--from alias path falls back to List
  • TestGmailSendCmd_RunJSON_PrimaryAccountNoDisplayName — graceful when no name anywhere
  • Full test suite passes (go test ./...)

🤖 Generated with Claude Code

salmonumbrella and others added 3 commits February 4, 2026 11:08
The condition `primary == nil && sa.IsPrimary` inside the email-matching
block can never be true because `primary` is already unconditionally set
to `sa` when `sa.IsPrimary` is true earlier in the same loop iteration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

Gmail send: display name not included in From header when using service account impersonation

1 participant