Skip to content

Add email display to person profile buttons and organization dropdowns#1002

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/update-person-profile-email
Draft

Add email display to person profile buttons and organization dropdowns#1002
Copilot wants to merge 6 commits intomainfrom
copilot/update-person-profile-email

Conversation

Copy link
Contributor

Copilot AI commented Feb 15, 2026

What is the goal of this PR and why is this important?

Person identification requires email visibility when multiple people share similar names. This adds email display in two contexts: person profile buttons (organizations index → people index) and person selection dropdowns (organization edit form).

How did you approach the change?

Added Person#preferred_email method

  • Centralizes email prioritization: user.email → person.email → email_2
  • Reusable across views and controllers

Updated people index view

<%= person_profile_button(person, subtitle: person.preferred_email) %>

Updated organization form dropdown

  • Changed joins(:user)left_joins(:user) to include people without user accounts
  • Uses pluck with COALESCE SQL for performance (avoids loading full records)
  • Format: "First Last (email@example.com)"
@people_array = Person.left_joins(:user)
  .pluck(:first_name, :last_name, :id, 
         Arel.sql("COALESCE(users.email, people.email, people.email_2)"))
  .map { |fn, ln, id, email| ["#{fn} #{ln}#{" (#{email})" if email.present?}", id] }

Anything else to add?

User associations already preloaded in people controller (line 10), avoiding N+1 queries.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits February 15, 2026 07:06
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Copilot AI changed the title [WIP] Update organizations index to add user email to person profile Add email display to person profile buttons and organization dropdowns Feb 15, 2026
Copilot AI requested a review from maebeale February 15, 2026 07:11
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