Skip to content

fix: show full country list when LMS sends no country allow-list [backport to verawood] - #1402

Open
RomkaSk wants to merge 1 commit into
openedx:masterfrom
RomkaSk:kravets/fix-empty-country-list-verawood
Open

RomkaSk wants to merge 1 commit into
openedx:masterfrom
RomkaSk:kravets/fix-empty-country-list-verawood

Conversation

@RomkaSk

@RomkaSk RomkaSk commented Sep 10, 2026

Copy link
Copy Markdown

Original PR to master: #1401


Description

Backport of #1401 to release/verawood. Clean git cherry-pick -x of the master commit; release/verawood carries the same sortedCountriesSelector code as master, so the diff is identical.

On the learner profile page the Country selector renders with a single empty placeholder option — no countries can be selected. This happens on any deployment that keeps the platform default REGISTRATION_EXTRA_FIELDS['country'] = 'hidden'.

The profile builds its list of selectable countries from the registration form description (GET /user_api/v1/account/registration/). That endpoint only includes a country field when the registration form is configured to show it. With the default 'hidden', countriesCodesList arrives as [], sortedCountriesSelector still applies the allow-list filter, and every country is removed. Regression from #1185 (Verawood ships it).

The fix ports the guard that frontend-app-account already has in removeDisabledCountries(): an empty allow-list means "the LMS does not restrict the choice", so the full localized list is returned. Where the LMS does send an allow-list, behaviour is unchanged. Embargoed countries are still rejected server-side on write, so this does not weaken the restriction. Full root-cause analysis and the Account Settings comparison are in #1401.

How Has This Been Tested?

  • Same change and tests as fix: show full country list when LMS sends no country allow-list #1401: new src/profile/data/selectors.test.js with three cases for sortedCountriesSelector (empty allow-list returns the full list; non-empty list filters to exactly those codes; the country already saved on the account is kept). The first case fails on release/verawood without this change.
  • npm run lint clean, npm run test green on Node 24: 14 suites, 85 tests, 5 snapshots.
  • Reproduced on a Tutor Verawood dev stack with the stock REGISTRATION_EXTRA_FIELDS: the country <select> had 1 option; with this change it lists all countries.

Merge Checklist

  • If your update includes visual changes, have they been reviewed by a designer? Send them a link to the Sandbox, if applicable. — N/A, no visual changes.
  • Is there adequate test coverage for your changes?

Post-merge Checklist

  • Deploy the changes to prod after verifying on stage or ask @jacobo-dominguez-wgu to do it.
  • 🎉 🙌 Celebrate! Thanks for your contribution.

@openedx-release-manager please review as a Verawood backport.

@openedx-webhooks

openedx-webhooks commented Sep 10, 2026 •

Copy link
Copy Markdown

Thanks for the pull request, @RomkaSk!

This repository is currently maintained by @jacobo-dominguez-wgu.

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
🔘 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.

@mphilbrick211

Copy link
Copy Markdown

Hi @RomkaSk! Welcome, and thank you for this contribution! In order for your CLA check to turn green, you'll need to submit a CLA form. If you are contributing as an individual, please fill out the individual CLA form here.

If you are contributing on behalf of an organization, please have your manager reach out to oscm@axim.org so you may be added to your org's existing entity agreement.

Please let me know if you have any questions. Thanks!

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Needs Tests Run or CLA Signed in Contributions Sep 17, 2026
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Sep 17, 2026
@cmltaWt0

Copy link
Copy Markdown

@mphilbrick211 I've submitted the request to oscm@axim.org.

@cmltaWt0

Copy link
Copy Markdown

@RomkaSk I believe we need to trigger the CI to the check on cla.

@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Sep 24, 2026
@e0d

e0d commented Sep 24, 2026

Copy link
Copy Markdown
Member

@RomkaSk bumping the CLA request.

@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.22%. Comparing base (da8ddb6) to head (2bf97d6).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1402      +/-   ##
==========================================
+ Coverage   81.17%   81.22%   +0.04%     
==========================================
  Files          51       51              
  Lines         834      836       +2     
  Branches      241      241              
==========================================
+ Hits          677      679       +2     
  Misses        150      150              
  Partials        7        7              

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: No status
Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

5 participants