Repository navigation
fix: drop target learner id from progress URL after masquerade change [ulmo backport] - #2216
muhammadali286 wants to merge 1 commit into
Conversation
On /course/:courseId/progress/:targetUserId the course home progress API (_get_student_user) returns the learner named in the URL and ignores the active masquerade. After a masquerade change the widget reloaded the same URL, so staff who switched to "View as <learner A>" while on learner B's progress page kept seeing learner B, with the toolbar showing learner A. After a successful masquerade change, navigate to the plain progress URL (preserving query string and hash) when on a learner-specific progress page; reload as before everywhere else.
|
Thanks for the pull request, @muhammadali286! 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:
🔘 Submit a signed contributor agreement (CLA)
If you've signed an agreement in the past, you may need to re-sign. Once you've signed the CLA, please allow 1 business day for it to be processed. 🔘 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 @@
## release/ulmo #2216 +/- ##
================================================
+ Coverage 90.83% 90.84% +0.01%
================================================
Files 345 345
Lines 5792 5801 +9
Branches 1339 1341 +2
================================================
+ Hits 5261 5270 +9
Misses 514 514
Partials 17 17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@feanil @sarina I am not doing individual contribution, I am doing this from Edly organization. Kindly guide me how to handle this CLA check. Thanks in advance |
|
Hey @openedx/cla-problems team, could you please have a look at @muhammadali286's question above? |
|
Re-triggering the CLA check: my Contributor Agreement is now on file. |
|
Thanks for the update @muhammadali286. It looks like the CLA check is still failing (or maybe it wasn't triggered/didn't run again). @openedx/cla-problems Could you please have a look and re-run the CLA check if necessary? |
|
Closing and reopening to clear the CLA check |
Backport of #2215 to
release/ulmo.Description
When staff open a learner-specific progress page (
/course/:courseId/progress/:targetUserId, e.g. via the Instructor Dashboard "View Progress Page" link) and then use the instructor toolbar to switch View this course as to a different learner (or to Staff / a cohort), the masquerade widget callslocation.reload(). The URL still carries the originaltargetUserId, and the course home progress API (lms/djangoapps/course_home_api/progress/views.py,_get_student_user) intentionally returns the learner named in the URL rather than the masqueraded one.Result: the toolbar shows learner A while the page shows learner B's progress. To staff this looks like masquerade is pulling up the wrong learner's data.
This PR adds
reloadAfterMasqueradeChange(). After a successful masquerade change, if the current path is a learner-specific progress URL, it navigates to the plain/progressURL (query string and hash preserved). Otherwise it reloads as before. Both call sites (MasqueradeUserNameInput,MasqueradeWidgetOption) use it.Steps to reproduce (before)
/learning/course/<course>/progress/<learnerB_id>.After
Step 2 lands on
/learning/course/<course>/progressand shows learner A's progress.Testing
MasqueradeWidget.test.tsx: learner-specific progress URL →location.assignto the plain progress URL (query/hash preserved); non-progress page → reload; plain progress page → reload; failed masquerade → neither.MasqueradeWidgetOption.test.tsxlocation mock extended withpathname/search/hash/assign./progress/<id>now shows the masqueraded learner, and masquerading from other tabs still reloads in place.To rerun CLA check.
🤖 Generated with Claude Code