Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds CourseAboutPageURLRequested and LMSPageURLRequested filters #35142

Merged
merged 5 commits into from
Oct 21, 2024

Conversation

jignaciopm
Copy link
Contributor

@jignaciopm jignaciopm commented Jul 19, 2024

Description

This PR introduces two new openedx-filters event org.openedx.course_authoring.lms.page.url.requested.v1 and org.openedx.learning.course_about.page.url.requested.v1. This is implemented to guaranty multi tenancy in eox-tenant in LMS_ROOT_URL from Studio to LMS, but eox-tenant is only an example would consider use.

Impact by the change on:

  • cms/djangoapps/contentstore/views/assets.py
  • common/djangoapps/util/course.py

Supporting information

There are not openedx related tickets. The related PR are:

Testing instructions

The change can be tested with testing instructions in eduNEXT/eox-tenant#219.

Deadline

"None"

Other information

⚠️

Warning: Once accepted this PR, it has to be merged only after openedx/openedx-filters#200 is merged and the requirements in this PR are updated.

⚠️

Settings

EDXAPP_EXTRA_REQUIREMENTS:
  - name: git+https://github.com/eduNEXT/eox-tenant.git@jipm/add_tenant_aware_filter

@openedx-webhooks
Copy link

Thanks for the pull request, @jignaciopm!

What's next?

Please work through the following steps to get your changes 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.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/wg-maintenance-edx-platform. Tag them in a comment and let them know that your changes are ready for review.

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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 19, 2024
@jignaciopm jignaciopm force-pushed the jipm/add_tenant_aware_filter branch 2 times, most recently from 51bfa7a to 9995472 Compare July 19, 2024 15:04
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 24, 2024
@mphilbrick211
Copy link

Hi @jignaciopm! Just flagging there are some failing checks here.

@mphilbrick211 mphilbrick211 removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 25, 2024
@jignaciopm jignaciopm force-pushed the jipm/add_tenant_aware_filter branch 2 times, most recently from 099e882 to 20a0c38 Compare August 7, 2024 16:49
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Aug 23, 2024
@e0d
Copy link
Contributor

e0d commented Sep 6, 2024

@jignaciopm Looks like there's a failed check.

@mphilbrick211 mphilbrick211 removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Sep 9, 2024
@mariajgrimaldi
Copy link
Member

Hey, @jignaciopm, thanks for contributing this! Those testing instructions are a bit out of date. Could you please include them directly in the cover letter, update and simplify them? Thanks!

Copy link
Member

@mariajgrimaldi mariajgrimaldi left a comment

Choose a reason for hiding this comment

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

I'll review this in detail once you apply the changes from the openedx-filters PR and all comments there are resolved. Thank you!

cms/djangoapps/contentstore/asset_storage_handlers.py Outdated Show resolved Hide resolved
common/djangoapps/util/course.py Outdated Show resolved Hide resolved
@jignaciopm jignaciopm changed the title feat: adds LmsUrlCreationStarted filter feat: adds CourseAboutPageURLRequested and LMSPageURLRequested filters Oct 1, 2024
Copy link
Member

@mariajgrimaldi mariajgrimaldi left a comment

Choose a reason for hiding this comment

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

I'm preparing my environment to test this. Thanks!

common/djangoapps/util/tests/test_filters.py Outdated Show resolved Hide resolved
common/djangoapps/util/tests/test_filters.py Show resolved Hide resolved
@mariajgrimaldi
Copy link
Member

@jignaciopm: Could you make the necessary adjustments so I can test this locally, mainly in eox-tenant? Or please update the testing instructions so I can test another way. Thank you!

@mariajgrimaldi
Copy link
Member

mariajgrimaldi commented Oct 3, 2024

Here's how I've been testing this:

  • Tutor in-line plugin with the filters configurations for both LMS/CMS:
from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-lms-common-settings",
"""
OPEN_EDX_FILTERS_CONFIG = {
    "org.openedx.learning.course_about.page.url.requested.v1": {
        "fail_silently": False,
        "pipeline": [
            "common.djangoapps.util.course.ChangeCourseAboutURL"
        ]
    },
    "org.openedx.course_authoring.lms.page.url.requested.v1": {
        "fail_silently": False,
        "pipeline": [
            "common.djangoapps.util.course.ChangeLMSBaseURL"
        ]
    }
}
"""
    )
)

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-cms-common-settings",
"""
OPEN_EDX_FILTERS_CONFIG = {
    "org.openedx.learning.course_about.page.url.requested.v1": {
        "fail_silently": False,
        "pipeline": [
            "common.djangoapps.util.course.ChangeCourseAboutURL"
        ]
    },
    "org.openedx.course_authoring.lms.page.url.requested.v1": {
        "fail_silently": False,
        "pipeline": [
            "common.djangoapps.util.course.ChangeLMSBaseURL"
        ]
    }
}
"""
    )
)

To save configuration time, instead of using eox-tenant as you suggested in the test instructions, I created a simple step that replaces the URL for different domain another-lms.local.edly.io:

# common/djangoapps/util/course.py
from openedx_filters import PipelineStep
class ChangeLMSBaseURL(PipelineStep):

    def run_filter(self, url, org):  # pylint: disable=arguments-differ,unused-argument
        return {
            "url": "http://another-lms.local.edly.io:8000",
            "org": org
        }
        
class ChangeCourseAboutURL(PipelineStep):

    def run_filter(self, url, org):  # pylint: disable=arguments-differ,unused-argument
        return {
            "url": "http://another-lms.local.edly.io:8000/courses/course-v1:OpenedX+DemoX+DemoCourse/about",
            "org": org
        }
        

By doing a quick search I found the list of places these two filters should cover. Please, let me know if I missed one.

CourseAboutPageURLRequested here's what I found by searching get_link_for_about_page

Coverage How to test
Settings context GET http://studio.local.edly.io:8001/api/contentstore/v1/course_settings/<COURSE_ID> or go to Schedule & Details (invite your students, course summary)
Course share URL GET http://local.edly.io:8000/api/learner_home/init
The mobile API GET http://local.edly.io:8000/api/mobile/v4/course_info/blocks/?course_id=<COURSE_ID>&username=admin

LMSPageURLRequested here's what I found by searching get_asset_json

Coverage How to test
Assets handler GET http://studio.local.edly.io:8001/assets/<COURSE_ID>/?page=0 or Go to Content > Files

@jignaciopm: please, let me know in a comment once you address the suggestions so I can test again.

@jignaciopm
Copy link
Contributor Author

@mariajgrimaldi do can you try again please?

@jignaciopm jignaciopm force-pushed the jipm/add_tenant_aware_filter branch 2 times, most recently from 93eb97b to 7fae713 Compare October 3, 2024 22:28
@mariajgrimaldi
Copy link
Member

Thank you, @jignaciopm, for addressing all my comments. I tested this again following the instructions I left here, and it seems to work fine. Now, please update the test docstrings because they seem to be out of date. I'll leave my approval afterward.

cms/djangoapps/contentstore/tests/test_filters.py Outdated Show resolved Hide resolved
cms/djangoapps/contentstore/tests/test_filters.py Outdated Show resolved Hide resolved
cms/djangoapps/contentstore/tests/test_filters.py Outdated Show resolved Hide resolved
common/djangoapps/util/tests/test_filters.py Outdated Show resolved Hide resolved
common/djangoapps/util/tests/test_filters.py Outdated Show resolved Hide resolved
common/djangoapps/util/tests/test_filters.py Outdated Show resolved Hide resolved
@mariajgrimaldi mariajgrimaldi self-requested a review October 9, 2024 11:32
@mariajgrimaldi
Copy link
Member

mariajgrimaldi commented Oct 16, 2024

Thank you so much for adding more extension points to enable seamless integrations!

While this solution, along with the pipeline steps you've implemented in your plugin, addresses the lack of org-awareness, it also raises a broader question of whether Studio should be more organization-aware overall. In some places, configurations are applied site-wide, while the organization context is considered in others. Although this discussion goes beyond the scope of this proposal, it’s an important conversation to have.

For now, let's put a pin in that and move forward with this solution.

@mariajgrimaldi mariajgrimaldi merged commit 123ad8d into openedx:master Oct 21, 2024
49 checks passed
@edx-pipeline-bot
Copy link
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
Contributor

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

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

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

@edx-pipeline-bot
Copy link
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
Contributor

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

1 similar comment
@edx-pipeline-bot
Copy link
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
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.

6 participants