-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix: exclude fields from UpstreamSyncMixin in advanced settings api #36831
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
fix: exclude fields from UpstreamSyncMixin in advanced settings api #36831
Conversation
|
Thanks for the pull request, @wgu-taylor-payne! 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:
🔘 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. |
|
@wgu-taylor-payne It would be great to have a unit test for this. What do you think? |
kdmccormick
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for the fix.
@dwong2708 it would be fine to add a new unit test for this, but the general mechanism of excluding fields from the advanced settings page is already being tested, and this is just a straightfoward usage of that existing mechanism, so I do not see a new test as necessary.
@wgu-taylor-payne If you'd like to add a new test, go ahead, otherwise I'm happy to merge this as-is. Let me know.
|
@kdmccormick Since the general mechanism is already being tested, and I haven't started writing any additional tests yet, you can go ahead an merge this in. Thank you! |
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
|
2U Release Notice: This PR has been deployed to the edX production environment. |
…36831) The UpstreamSyncMixin introduced in [1] which is added as a XBlock mixin, currently contains four fields - `upstream`, `upstream_version`, `upstream_version_declined`, and `upstream_display_name`. These fields are coming through in the course advanced settings API endpoint (`/api/contentstore/v0/advanced_settings/{course_id}`), and subsequently show up in the Advanced Settings view in the frontend-app-authoring MFE, which they shouldn't. This PR resolves this issue by adding the fields from the `UpstreamSyncMixin` into the FIELDS_EXCLUDE_LIST [2] of the `CourseMetadata` class. Unless the API is called with `fetch_all=1` (the authoring MFE uses `fetch_all=0`), then these fields will be filtered out. [1] https://github.com/openedx/edx-platform/blob/master/cms/lib/xblock/upstream_sync.py#L289 [2] https://github.com/openedx/edx-platform/blob/master/cms/djangoapps/models/settings/course_metadata.py#L41 Fixes: openedx/frontend-app-authoring#2018
Description
The UpstreamSyncMixin (introduced in #34925) which is added as a XBlock mixin, currently contains four fields -
upstream,upstream_version,upstream_version_declined, andupstream_display_name. These fields are coming through in the course advanced settings API endpoint (/api/contentstore/v0/advanced_settings/{course_id}), and subsequently show up in the Advanced Settings view in the frontend-app-authoring MFE.Here is a JSON snippet showing one of those fields coming through in the API response:
As can be seen in openedx/frontend-app-authoring#2018, these fields are showing up in the Advanced Settings view for a course, when they shouldn't be.
This PR resolves this issue by adding the fields from the
UpstreamSyncMixininto the FIELDS_EXCLUDE_LIST of theCourseMetadataclass. Unless the API is called withfetch_all=1(the authoring MFE usesfetch_all=0), then these fields will be filtered out.Once this PR is merged in, the upstream fields will no longer show by default in the Advanced Settings view in the cms.
Supporting information
Resolves openedx/frontend-app-authoring#2018.
Testing instructions
Other information
This issue appears to be in Teak:
https://github.com/openedx/edx-platform/blob/release/teak/cms/djangoapps/models/settings/course_metadata.py#L41
https://github.com/openedx/edx-platform/blob/release/teak/cms/lib/xblock/upstream_sync.py#L289
You can see the fields appear here in this Teak sandbox, for example.
This issue appears to be in Sumac:
https://github.com/openedx/edx-platform/blob/open-release/sumac.master/cms/lib/xblock/upstream_sync.py#L379
https://github.com/openedx/edx-platform/blob/open-release/sumac.master/cms/djangoapps/models/settings/course_metadata.py#L41