Skip to content

fix: show initials when profile photos fail to load - #228

Open
joahg wants to merge 1 commit into
block:mainfrom
joahg:joah/fix-avatar-fallback
Open

joahg wants to merge 1 commit into
block:mainfrom
joahg:joah/fix-avatar-fallback

Conversation

@joahg

@joahg joahg commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

What changed and why

Fixes AGNTOPS-559.

Users with a configured but unavailable profile photo currently get a broken image instead of the initials shown for users without a photo URL. Keep initials visible while photos load, reveal successfully loaded photos, and remove failed images without changing avatar dimensions.

Use the shared fallback for plan viewers and library headers as well as existing avatar-helper consumers. Preserve profile links, accessible names, lazy loading, and live Turbo Stream updates. No external avatar service is needed.

Evidence

Synthetic users: Alex Morgan has a failed photo, Sam Rivera has no photo URL, and Taylor Chen has a valid image. Screenshots were captured from passing browser specs and visually inspected.

Light Dark
Plan viewer avatars, light theme Plan viewer avatars, dark theme
Profile fallback, light theme Profile fallback, dark theme

Testing

  • bundle exec rspec spec/helpers/application_helper_spec.rb spec/system/avatars_spec.rb spec/channels/coplan/plan_presence_channel_spec.rb — 20 examples, 0 failures.

  • Browser specs exercise failed/missing/valid photos in both themes, profile-link navigation, failures completed before Stimulus connects, and live broadcast replacements without resizing.

  • bundle exec rubocop engine/app/helpers/coplan/application_helper.rb spec/helpers/application_helper_spec.rb spec/system/avatars_spec.rb — no offenses.

  • node --input-type=module --check < engine/app/javascript/controllers/coplan/avatar_controller.js and git diff --check — passed.

  • bundle exec rspec — 2,268 examples, 0 failures (4 minutes 27 seconds).

  • Used Ruby 3.4 and an isolated disposable local MySQL database. No shared database changes.

  • Manual diff review completed. The repository's named code-review skill is unavailable locally and in the skill catalog.

  • Added real JavaScript-enabled browser specs for the changed UI behavior.

  • Added helper specs for initials, accessible naming, escaping, and viewer styling.

  • Ran the full suite to completion.

  • Tested affected UI in both light and dark themes.

  • Attached and inspected images demonstrating the fix.

Render initials underneath profile photos and reveal images only after they load. Share the fallback across user avatars, viewer presence, and library headers.

Cover missing and failed images, successful photos, pre-connect failures, live Turbo updates, and both themes.

AGNTOPS-559
Amp-Thread-ID: https://ampcode.com/threads/T-01a0da07-fcd3-7281-9975-3b6c29b7e3ef
Co-authored-by: Amp <amp@ampcode.com>
@joahg
joahg marked this pull request as ready for review September 25, 2026 20:00
@joahg
joahg requested a review from HamptonMakes as a code owner September 25, 2026 20:00
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