Skip to content

fix: drop target learner id from progress URL after masquerade change [ulmo backport] - #2216

Open
muhammadali286 wants to merge 1 commit into
openedx:release/ulmofrom
edly-io:fix/masquerade-progress-target-user-ulmo
Open

muhammadali286 wants to merge 1 commit into
openedx:release/ulmofrom
edly-io:fix/masquerade-progress-target-user-ulmo

Conversation

@muhammadali286

@muhammadali286 muhammadali286 commented Oct 21, 2026 •

Copy link
Copy Markdown

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 calls location.reload(). The URL still carries the original targetUserId, 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 /progress URL (query string and hash preserved). Otherwise it reloads as before. Both call sites (MasqueradeUserNameInput, MasqueradeWidgetOption) use it.

Steps to reproduce (before)

  1. As staff, open /learning/course/<course>/progress/<learnerB_id>.
  2. View this course as → Specific learner → learner A → Enter.
  3. The toolbar shows learner A; the page still shows "Course progress for learnerB".

After

Step 2 lands on /learning/course/<course>/progress and shows learner A's progress.

Testing

  • New tests in MasqueradeWidget.test.tsx: learner-specific progress URL → location.assign to the plain progress URL (query/hash preserved); non-progress page → reload; plain progress page → reload; failed masquerade → neither.
  • MasqueradeWidgetOption.test.tsx location mock extended with pathname/search/hash/assign.
  • Verified manually on an Ulmo deployment: masquerading from /progress/<id> now shows the masqueraded learner, and masquerading from other tabs still reloads in place.

To rerun CLA check.

🤖 Generated with Claude Code

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.
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 21, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @muhammadali286!

This repository is currently maintained by @openedx/committers-frontend-app-learning.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Submit a signed contributor agreement (CLA)

⚠️ We ask all contributors to the Open edX project to submit a signed contributor agreement or indicate their institutional affiliation.
Please see the CONTRIBUTING file for more information.

If you've signed an agreement in the past, you may need to re-sign.
See The New Home of the Open edX Codebase for details.

Once you've signed the CLA, please allow 1 business day for it to be processed.
After this time, you can re-run the CLA check by adding a comment below that you have signed it.
If the CLA check continues to fail, you can tag the @openedx/cla-problems team in a comment for further assistance.

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.84%. Comparing base (1d5484f) to head (e74eba5).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@muhammadali286

Copy link
Copy Markdown
Author

@feanil @sarina I am not doing individual contribution, I am doing this from Edly organization. Kindly guide me how to handle this CLA check.
Sometimes I do want to contribute on individual level as well but I blocked by same CLA check, I had requested CLA once but I don't know the status of my request. Could you guys please guide me.

Thanks in advance

@UsamaSadiq UsamaSadiq closed this Oct 28, 2026
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in Contributions Oct 28, 2026
@UsamaSadiq UsamaSadiq reopened this Oct 28, 2026
@itsjeyd itsjeyd moved this from Done to Needs Triage in Contributions Oct 29, 2026
@itsjeyd itsjeyd added product review PR requires product review before merging backport PR backports a change from main to a named release. labels Oct 29, 2026
@itsjeyd itsjeyd moved this from Needs Triage to Needs Tests Run or CLA Signed in Contributions Oct 29, 2026
@itsjeyd

itsjeyd commented Nov 6, 2026

Copy link
Copy Markdown

Hey @openedx/cla-problems team, could you please have a look at @muhammadali286's question above?

@muhammadali286

Copy link
Copy Markdown
Author

Re-triggering the CLA check: my Contributor Agreement is now on file.

@itsjeyd

itsjeyd commented Nov 12, 2026

Copy link
Copy Markdown

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?

@bmtcril

bmtcril commented Nov 16, 2026

Copy link
Copy Markdown

Closing and reopening to clear the CLA check

@bmtcril bmtcril closed this Nov 16, 2026
@github-project-automation github-project-automation Bot moved this from Needs Tests Run or CLA Signed to Done in Contributions Nov 16, 2026
@bmtcril bmtcril reopened this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport PR backports a change from main to a named release. open-source-contribution PR author is not from Axim or 2U product review PR requires product review before merging

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants