Skip to content

Show sender on notifications index#1601

Merged
maebeale merged 1 commit into
mainfrom
maebeale/smaller-grey-text
Jun 8, 2026
Merged

Show sender on notifications index#1601
maebeale merged 1 commit into
mainfrom
maebeale/smaller-grey-text

Conversation

@maebeale

@maebeale maebeale commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

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

  • Surfaces who sent each system notification on the index, so staff can tell portal-generated emails apart from staff-sent ones without opening each record.

How did you approach the change?

  • Renamed the Recipient column to People and split the cell into two lines: To: [recipient email] and a smaller, lighter From: [sender name].
  • From falls back to AWBW portal when a notification has no sender (the association is optional).
  • Eager-loaded sender: :person in the controller so the new From line doesn't trigger N+1 queries.

UI Testing Checklist

  • System notifications index shows a People column with To/From lines
  • Notifications with a sender show the sender's name; sender-less notifications show AWBW portal

Anything else to add?

  • The From line uses sender.full_name, which falls back to the sender's email when their person/name is blank.

Surfaces who sent each notification so staff can distinguish
portal-generated emails from staff-sent ones at a glance, rather
than opening each record. Eager-loads the sender to avoid N+1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@maebeale maebeale marked this pull request as ready for review June 8, 2026 18:12
if turbo_frame_request?
per_page = params[:number_of_items_per_page].presence || 25
base_scope = authorized_scope(Notification.includes(:noticeable))
base_scope = authorized_scope(Notification.includes(:noticeable, sender: :person))

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 From Claude: Added sender: :person to the eager-load so the new From: line (which reads through sender.full_namesender.person) doesn't trigger N+1 queries on the index.

@maebeale maebeale merged commit b082a00 into main Jun 8, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/smaller-grey-text branch June 8, 2026 18:23
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