fix: exclude fields from UpstreamSyncMixin in advanced settings api (#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: https://github.com/openedx/frontend-app-authoring/issues/2018
This commit is contained in:
Taylor Payne
2025-06-04 11:38:30 -06:00
committed by GitHub
parent f58c6f04fa
commit 3e83efa609

View File

@@ -82,6 +82,10 @@ class CourseMetadata:
'is_onboarding_exam',
'discussions_settings',
'copied_from_block',
"upstream",
"upstream_version",
"upstream_version_declined",
"upstream_display_name",
]
@classmethod