Skip to content

Comments

use aliases in email-composer#1233

Merged
MrgSub merged 4 commits intostagingfrom
06-07-use_aliases_in_email-composer
Jun 10, 2025
Merged

use aliases in email-composer#1233
MrgSub merged 4 commits intostagingfrom
06-07-use_aliases_in_email-composer

Conversation

@ahmetskilinc
Copy link
Contributor

@ahmetskilinc ahmetskilinc commented Jun 7, 2025

Add email alias selection to the email composer

Description

This PR adds the ability for users to select which email alias to send from in the email composer. It displays a dropdown of available email aliases when composing a new email, allowing users to choose their sending identity. The feature is only shown when creating new emails, not when replying to existing messages.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🎨 UI/UX improvement

Areas Affected

  • User Interface/Experience

Summary by CodeRabbit

  • New Features

    • Added the ability to select a "From" email address when composing a new email, allowing users to choose from multiple email aliases.
    • Introduced a dropdown menu to display and select available email aliases, with clear indication of the primary alias.
    • Enhanced reply email sender selection to automatically match the sender address with recipients from the original message for more accurate "From" email choice.
  • Style

    • Updated the subject input area with a new bottom border for improved visual separation.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 7, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The changes introduce support for selecting a "From" email address in the email composer by adding an aliases dropdown. The EmailComposer component now accepts an aliases prop and displays a select menu for choosing the sending address. Related components are updated to supply the necessary props, and .gitignore is modified to ignore tools.json.

Changes

File(s) Change Summary
.gitignore Added tools.json to ignored files and inserted a newline after tsx-0/ under the devcontainer section.
apps/mail/components/create/create-email.tsx Added optional fromEmail parameter to handleSendEmail; passes aliases prop to EmailComposer.
apps/mail/components/create/email-composer.tsx Adds alias selection: new aliases and replyingTo props, "From" dropdown UI, fromEmail field in form, and updates callback types.
apps/mail/components/mail/reply-composer.tsx Passes replyingTo prop to EmailComposer based on the sender's email in replies; refines fromEmail selection logic using alias matching.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CreateEmail
    participant EmailComposer

    User->>CreateEmail: Open compose email
    CreateEmail->>EmailComposer: Render with aliases prop
    User->>EmailComposer: Select "From" email alias
    EmailComposer->>EmailComposer: Update form state (fromEmail)
    User->>EmailComposer: Compose and send email
    EmailComposer->>CreateEmail: Call onSendEmail with fromEmail and other data
Loading

Possibly related PRs

Poem

In the meadow of mail, a rabbit hops quick,
Now choosing "From" which alias to pick.
With dropdowns and fields, so tidy and neat,
Sending an email is now quite a treat!
Ignore that tools.json, let clutter not stay—
Hooray for new features, hip hip hooray!
🐇📧


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 851ac44 and 0ccc869.

📒 Files selected for processing (3)
  • apps/mail/components/create/create-email.tsx (2 hunks)
  • apps/mail/components/create/email-composer.tsx (8 hunks)
  • apps/mail/components/mail/reply-composer.tsx (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ahmetskilinc ahmetskilinc marked this pull request as ready for review June 7, 2025 16:14
@ahmetskilinc ahmetskilinc marked this pull request as draft June 7, 2025 16:15
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/mail/components/create/email-composer.tsx (1)

928-928: Verify styling consistency.

The addition of border-b class to the subject container should be consistent with the overall design. Ensure this doesn't create visual inconsistencies.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83b47b2 and 7f0cbfa.

📒 Files selected for processing (4)
  • .gitignore (1 hunks)
  • apps/mail/components/create/create-email.tsx (1 hunks)
  • apps/mail/components/create/email-composer.tsx (8 hunks)
  • apps/mail/components/mail/reply-composer.tsx (1 hunks)
🔇 Additional comments (8)
.gitignore (1)

60-62: LGTM!

Adding tools.json to .gitignore is appropriate for excluding development tool configurations from version control.

apps/mail/components/create/email-composer.tsx (6)

10-16: LGTM!

The import statements for the Select components are properly structured and follow the existing import patterns in the file.


57-62: LGTM!

The new props are well-defined with appropriate TypeScript interfaces. The aliases prop structure with email, name, and primary fields provides good flexibility for displaying alias information.

Also applies to: 70-70


108-110: LGTM!

The destructuring of the new props with appropriate default values is correctly implemented.


181-181: LGTM!

The default value logic for fromEmail correctly prioritizes the primary alias first, then falls back to the first alias, providing a sensible user experience.


265-265: LGTM!

The form field watching and data passing to the onSendEmail callback are correctly implemented.

Also applies to: 323-323


952-980: LGTM! Well-implemented alias selection UI.

The conditional rendering logic is correct - the "From" selector only appears when:

  1. Aliases are available (aliases.length > 0)
  2. Not in reply mode (!replyingTo)

The Select component implementation properly handles:

  • Value binding to form state
  • Change handling with form updates
  • Display formatting with name and email
  • Primary alias indication
apps/mail/components/mail/reply-composer.tsx (1)

238-238: LGTM!

Correctly passing the replyingTo prop to disable alias selection during reply composition, which provides the appropriate UX behavior.

@ahmetskilinc ahmetskilinc marked this pull request as ready for review June 7, 2025 16:54
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/mail/components/create/create-email.tsx (1)

106-106: Consider validating that a valid sender email is available.

The fallback logic is well-structured, but there's a potential edge case where all email sources could be unavailable, resulting in an empty fromEmail. Consider adding validation to ensure a valid sender email exists before proceeding with the send operation.

 const fromEmail = data.fromEmail || aliases?.[0]?.email || userEmail;
+
+if (!fromEmail) {
+  throw new Error('No valid sender email available');
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f0cbfa and a56e971.

📒 Files selected for processing (1)
  • apps/mail/components/create/create-email.tsx (2 hunks)
🔇 Additional comments (2)
apps/mail/components/create/create-email.tsx (2)

104-104: Good addition of optional fromEmail parameter.

The optional fromEmail parameter correctly extends the function signature to support alias selection functionality.


185-185: Excellent - dynamic aliases prop now properly used.

This correctly resolves the previous issue with hardcoded test data and properly passes the dynamic aliases to the EmailComposer component.

@ahmetskilinc ahmetskilinc requested review from MrgSub and nizzyabi June 7, 2025 16:58
@MrgSub MrgSub merged commit 766fb69 into staging Jun 10, 2025
2 of 3 checks passed
Copy link
Collaborator

MrgSub commented Jun 10, 2025

Merge activity

@MrgSub MrgSub deleted the 06-07-use_aliases_in_email-composer branch June 10, 2025 20:37
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.

2 participants