fix: size and crop Studio profile avatars - #678
Conversation
|
Thanks for the pull request, @edschema! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #678 +/- ##
==========================================
- Coverage 73.07% 72.97% -0.11%
==========================================
Files 60 60
Lines 520 518 -2
Branches 110 107 -3
==========================================
- Hits 380 378 -2
Misses 137 137
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
This PR fixes the bug @bradenmacdonald raised in reviewing the avatar fix openedx/frontend-app-authoring#3043
This updates the previously merged #670 fix to properly render circular images, and removes the unused
.avatar... I incorrectly assumed it was some legacy contract, but given the discovery in #673 , I just removed it.Prior to #670: No avatar images ever loaded
StudioHeaderpassed onlyauthenticatedUser.avatarto the Studio user menu.UserMenualready had two rendering paths:<img>withd-block w-100 h-100.Avatarwithsize="sm"andmr-2.authenticatedUser.avatarStudio did not read the uploaded profile image exposed through the hydrated
authenticatedUser.profileImagedata, so uploaded Open edX profile images did not reach the raw-image path.#670: Added Avatar images when available
#670 updated
StudioHeaderto use the hydrated profile image when available:authenticatedUser.avatar.profileImage.imageUrlMediumwhenprofileImage.hasImageis true.The companion Authoring change, openedx/frontend-app-authoring#3043, enables authenticated-user hydration so Studio can receive that profile-image data.
#670 intentionally changed only avatar URL selection. It did not change how
UserMenupresents an avatar after receiving a URL.When tested, the image rendered as expected, but
w-100 h-100made the menu button layout to determine the image dimensions causing the issue Braden found.This PR
This PR replaces the separate raw-image and fallback branches with the existing Paragon
Avatarcomponent for both states. The selected profile-image URL is passed throughsrc, allowing Paragon to provide:This PR also removes the unsupported
authenticatedUser.avatarand now selectsprofileImage.imageUrlMediumwhenprofileImage.hasImageis true. The change preserves the accessible name,mr-2spacing, andavatar-image/avatar-icontest hooks.This is the sizing and cropping follow-up reported in #673, with cleanup to remove
authenticatedUser.avatarTests Done
npm test -- --runTestsByPath src/studio-header/StudioHeader.test.tsx --runInBand— 1 suite and 15 tests passed.npm run types— passed.git diff --check— passed.AI Assistance
AI tools were used to aid in diagnosis, planning, implementation, and review. All work was manually verified.