fix(b2b): show learner email and icon avatar when name is blank - #3992
Merged
Merged
Conversation
The learner-progress API returns full_name as "" (not null) for learners who never set a profile name. LearnerRow's `??` fallback only caught null, so those rows rendered an empty name and a "?" avatar. - Treat null, empty, and whitespace-only names as missing - Always show the learner's email under the name - Show a generic person icon instead of "?" when there is no name Follow-up to #3958. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenAPI ChangesNo changes detected Unexpected changes? Ensure your branch is up-to-date with |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The runtime changes are correct and tested; the remaining comment concerns only dormant checkbox code.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Fixes blank learner identities in the B2B contract learner directory.
Changes:
- Normalizes blank names and shows email separately.
- Uses a generic avatar icon when names are unavailable.
- Adds coverage for null, empty, and whitespace-only names.
| File | Description |
|---|---|
LearnerRow.tsx |
Updates learner identity and avatar rendering. |
ContractLearnersPage.test.tsx |
Tests named and unnamed learner rows. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
mbertrand
pushed a commit
that referenced
this pull request
Oct 1, 2026
mbertrand
pushed a commit
that referenced
this pull request
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What are the relevant tickets?
Follow-up to #3958
Description (What does it do?)
Fix blank learner names on the B2B contract learner directory (
/organization/:orgSlug/contract/:contractSlug/learners).In prod, many rows show a "?" avatar and no name, with only the course title.
LearnerRowusedrow.full_name ?? row.email, and??only falls back on null or undefined. A null name would have fallen back to the email, so the blank rows meanfull_nameis""or whitespace.row.full_name?.trim() || null), and skip the name line when there's no nameRiUserLine) instead of "?" when there's no name. "?" reads as an error, and initials taken from an email are wrong for addresses likejdoe@orx7k2m@. The avatar staysaria-hidden.Companion PR: mitodl/ol-analytics-api#71 returns blank names as
null, so they stop sorting ahead of every real name on page 1.Implementation details
aria-labelnow falls back toname ?? row.email, so turning that block back on can't produce "Select null".Screenshots (if appropriate):
BEFORE

AFTER

How can this be tested?
Automated:
yarn test frontends/main/src/app-pages/ContractLearnersPage. New tests cover name + email + initials, and null,"", and whitespace-only names (email shown, icon avatar, no "?").Locally, with the analytics-api stub from mitodl/ol-infrastructure#5788. You don't need mitodl/ol-analytics-api#71: local dev uses the stub in place of the real API, and this change doesn't depend on the sort order.
Set up the stub by following the "How to use it" steps in ol-infrastructure#5788. The stub includes three learners with no usable name:
full_namenullx7k2m@example.edu""jdoe@example.edu" "sso.user.4471@example.eduOpen a contract's learner directory at
/organization/<orgSlug>/contract/<contractSlug>/learners. The stub answers every contract with the same data.At the top of page 1, the
""and" "rows show a person icon, the email, and the course title. There's no "?" and no empty name line. Thenullrows show the same way at the end of page 2.Named learners still show initials, name, email, and course title.
Search for
jdoeorx7k2mto find those rows.Additional Context
🤖 Generated with Claude Code