Skip to content

feat [FC-86]: update course_about & catalog link generation - #37342

Merged
feanil merged 12 commits into
openedx:masterfrom
raccoongang:nanai/axm-2166/update-link-generation
Sep 29, 2025
Merged

feat [FC-86]: update course_about & catalog link generation#37342
feanil merged 12 commits into
openedx:masterfrom
raccoongang:nanai/axm-2166/update-link-generation

Conversation

@Serj-N

@Serj-N Serj-N commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

Note

Related to: #37341

Description

This PR updates the logic for generating URLs for the course about page and catalog page.

Key changes:

  • In get_link_for_about_page(course), if use_catalog_mfe() is true:

    • The course about page URL is set to:
      ${CATALOG_MICROFRONTEND_URL}/courses/<course_id>/about
  • In get_platform_settings(), if use_catalog_mfe() is true:

    • The catalog link is set to:
      ${CATALOG_MICROFRONTEND_URL}/courses

Configuration:

  • CATALOG_MICROFRONTEND_URL added as a Django setting for constructing MFE URLs.
  • All behavior remains configurable via Site Configuration.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 10, 2025
@openedx-webhooks

openedx-webhooks commented Sep 10, 2025

Copy link
Copy Markdown

Thanks for the pull request, @Serj-N!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

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.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Sep 10, 2025
@Serj-N Serj-N changed the title feat: [FC-86] update course_about & catalog link generation feat [FC-86]: update course_about & catalog link generation Sep 10, 2025
@Serj-N Serj-N self-assigned this Sep 10, 2025
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Sep 10, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Sep 10, 2025
@Serj-N
Serj-N force-pushed the nanai/axm-2166/update-link-generation branch from f157bdb to c64ec1f Compare September 23, 2025 17:46
@Serj-N
Serj-N marked this pull request as ready for review September 23, 2025 17:46
@Serj-N
Serj-N requested a review from a team as a code owner September 23, 2025 17:46
@peterkulko
peterkulko requested review from bradenmacdonald, feanil and sarina and removed request for bradenmacdonald and peterkulko September 23, 2025 18:39
Comment thread lms/envs/test.py Outdated
ZENDESK_API_KEY = ""
ZENDESK_USER = ""

CATALOG_MICROFRONTEND_URL = "http://catalog-mfe"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done

@sarina sarina moved this from Waiting on Author to Ready for Review in Contributions Sep 24, 2025

@feanil feanil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a few changes but the approach and the places where you've made the code changes make sense to me so I think once we agree on the implementation details, this should be good to go.

Comment thread common/djangoapps/util/course.py Outdated
Comment on lines 54 to 71

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the change as you have it, when we move to the new MFE, the CourseAboutPageURLRequested filter will stop working. We don't want to do that, but also the fact that this filter only runs in the last conditional is a bug in my opinion. Also, the way the URL is built in the final else clause is nearly the same as in the new clause you're adding. I think you should do the following:

  1. Pull Lines 66-71 which call the filter, out of the if clause so that it always runs. This is I think the correct behavior long-term.
  2. Extract the about_base_url value up from the last clause and set it to the mfe base or lms base based on the conditional. This has a few benefits.
    a. When we come back to clean this up as a part of dropping the old LMS implementation, the cleanup is easier because it's obvious what to delete.
    b. The hardcoded url structure only lives on one line and isn't duplicated spreading the assumption about about page URL structure.
    c. The other two if statements look like legacy 2U specific code and hopefully will be removed in the future in which case all the code worth keeping is localized in the last clause making that future cleanup easier.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points, both changes implemented.

Comment on lines +11 to 15
Returns a boolean = true if the Catalog MFE is enabled.
"""
return configuration_helpers.get_value(
'ENABLE_CATALOG_MICROFRONTEND', settings.FEATURES['ENABLE_CATALOG_MICROFRONTEND']
'ENABLE_CATALOG_MICROFRONTEND', settings.FEATURES.get('ENABLE_CATALOG_MICROFRONTEND')
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are now saying that this returns a boolean, which means in should never return None which can currently happen if the setting is not set. Either set a default for this value here or in the common.py settings file (I would prefer in the common.py settings file).

Also note, we have stopped using the FEATURES dictionary as a part of the platform settings simplification work. You should not use it in your new code and update anything that you're touching to drop its usage as it makes sense. You don't need to fix everything but do the minimal necessary to not add new code that uses this deprecated setting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENABLE_CATALOG_MICROFRONTEND is already in common.py. I changed this line to look up the key directly in settings, and adjusted the many tests that looked up this value from FEATURES.

@sarina

sarina commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

@Serj-N can you please address failing tests so I can ask Feanil for another review today. I see

FAILED common/djangoapps/util/tests/test_course.py::TestCourseSharingLinks::test_sharing_link_with_settings_4__False__False___http___localhost_8000_courses_course_v1_test_org_test_number_test_run_about__ - 
AttributeError: <UserSettingsHolder> does not have the attribute 'ENABLE_CATALOG_MICROFRONTEND'

@Serj-N
Serj-N force-pushed the nanai/axm-2166/update-link-generation branch from bba5faa to cb4dcb0 Compare September 29, 2025 12:41
@Serj-N

Serj-N commented Sep 29, 2025

Copy link
Copy Markdown
Contributor Author

@sarina Done, tests fixed

@sarina

sarina commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

@feanil could we get a re-review here today, to unblock #37341 ?

@feanil
feanil merged commit d34a6b9 into openedx:master Sep 29, 2025
65 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for Review to Done in Contributions Sep 29, 2025
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

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

Labels

FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants