Skip to content

feat(avatar): show the Permitteer picture first, then Gravatar, then the initial - #1294

Merged
JamieRuderman merged 6 commits into
mainfrom
feat/avatar-permitteer-picture
Oct 16, 2026
Merged

JamieRuderman merged 6 commits into
mainfrom
feat/avatar-permitteer-picture

Conversation

@JamieRuderman

@JamieRuderman JamieRuderman commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Changes

Avatars now show the picture Permitteer has for an account first, then Gravatar, then the initial. Until now every avatar went straight to Gravatar, even though the app already kept each signed-in account's id_token picture (Google photos, for example) in its account registry. Only the account switcher used it, and it never fell back to Gravatar.

  • Lookup. oidcPicture(email) in services/oidc.ts finds an account's picture in the registry by email, ignoring case. Only accounts signed in on this browser have one, because Permitteer stores the picture per login session, not per user.
  • Avatar. The shared Avatar tries the sign-in picture, then Gravatar, then the initial. An optional picture prop (https only) takes priority over the lookup.
    • It shows the initial until a picture has actually loaded. MUI's Avatar keeps a blank <img> up while its src loads, so a load that never errors left an empty coloured circle. That's what the org circles in the iOS TestFlight sidebar showed.
    • Gravatar is now asked with the documented d=404, a straight 404 for an unknown email. The old d=force-fail redirected to http://i1.wp.com/force-fail.
  • Account switcher. The rows in AvatarMenu now use the shared Avatar with the picture they already have, so they fall back to Gravatar too and get the same colours.
  • Gravatar hash. Gravatar URLs now use a SHA-256 hash of the trimmed, lower-cased email, which Gravatar supports alongside MD5. CodeQL had flagged MD5 as a weak hash over registry data. Mixed-case emails now match their Gravatar too. md5 is replaced by @noble/hashes, pinned to the 2.3.0 the lockfile already held as a dev dependency.
  • Profile. The caption says the picture comes from the account you sign in with, such as Google, or else from Gravatar. It is translated into de, es and ja, and the old gravatarImported key is gone.

Other people (org members, guests, device owners) still go Gravatar → initial. A server-side picture on the graphql User is the follow-up that will pass through the new picture prop.

Testing

  • New Avatar.test.tsx runs the real MUI component with a stubbed Image. It checks:
    • the initial shows until a picture loads;
    • the sign-in picture → Gravatar → initial order;
    • the initial stays when a load never settles;
    • Gravatar hashing;
    • a handed picture, and that a non-https one is ignored.
  • A case checks that the Gravatar hash is trimmed and lower-cased.
  • New oidcPicture cases in oidc.test.ts.
  • tsc --noEmit and npm run i18n:check pass.
  • Not checked in a browser, because that needs a real Google sign-in.

@JamieRuderman

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T20:49:06.425059Z a293e56 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread frontend/src/components/Avatar/Avatar.tsx Fixed
@aws-amplify-us-west-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1294.d20k671nqqv4kl.amplifyapp.com

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 85e26eac31

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

JamieRuderman added a commit that referenced this pull request Oct 16, 2026
@JamieRuderman

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: a293e5678b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@JamieRuderman
JamieRuderman merged commit c5fcb8c into main Oct 16, 2026
7 checks passed
@JamieRuderman
JamieRuderman deleted the feat/avatar-permitteer-picture branch October 16, 2026 20:57
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