Skip to content

refactor: read and update advanced settings from authoring v1 (FC-0118) - #3366

Draft
taimoor-ahmed-1 wants to merge 1 commit into
openedx:masterfrom
taimoor-ahmed-1:taimoor-ahmed/fc0118-advanced-settings
Draft

taimoor-ahmed-1 wants to merge 1 commit into
openedx:masterfrom
taimoor-ahmed-1:taimoor-ahmed/fc0118-advanced-settings

Conversation

@taimoor-ahmed-1

@taimoor-ahmed-1 taimoor-ahmed-1 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

Part of #3361 (FC-0118 Phase 3, parent openedx/openedx-platform#39349).

Draft until openedx/openedx-platform#39303 merges: it adds the endpoint this PR calls. The old address stays live until it is removed through the DEPR process (openedx/openedx-platform#39128).

Moves the three advanced-settings callers from GET/PATCH /api/contentstore/v0/advanced_settings/{course_id} to GET/PATCH /api/authoring/v1/courses/{course_key}/advanced_settings/.

  • Advanced Settings page (src/advanced-settings/data/api.ts): reads the default view, which is the editable set that fetch_all=0 returned, and saves with PATCH as before. Success responses have the same shape.
  • Errors: v1 returns the standard error body with errors: {setting_name: [message, …]} (and non_field_errors for a failure tied to no setting). getAdvancedSettingsErrors turns that into the {key, message} list the error dialog shows. v0's {developer_message: [...]} body was assigned to the dialog as an object, so the dialog showed "0 validation error" with no messages. ModalErrorListItem no longer crashes on a key that is not a setting.
  • Pages & Resources (src/pages-and-resources/data/api.js): now sends fields (v1's name). filter_fields was passed as an axios config key and never reached the server, so v0 returned every setting.
  • Problem editor (src/editors/data/services/cms/urls.ts): reads max_attempts, showanswer, show_reset_button and rerandomize, all in the default view. initializeProblem already skipped this request for lib: keys. It now also skips library-v1: keys, which got a 404 from v0 as they would from v1.

User roles impacted: Course Author (Settings → Advanced Settings; Pages & Resources; problem editor). The error dialog now lists each refused setting with its message; it used to show "0 validation error" and no messages.

Supporting information

Testing instructions

  1. Studio → Settings → Advanced Settings: the page loads (GET …/api/authoring/v1/courses/<key>/advanced_settings/). Change a setting and save (PATCH, same address).
  2. Enter an invalid value (for example text in Maximum Attempts) and save: the dialog lists that setting with the server's message.
  3. Open a problem component in the editor: the defaults load.
  4. Content → Pages & Resources → open the ORA, progress, teams and wiki settings: each loads its current value and saves.
  5. npm test -- src/advanced-settings src/pages-and-resources plugins/course-apps src/editors/data/services/cms src/editors/data/redux/thunkActions/problem

Other information

  • getCourseAdvancedSettingsApiUrl in Pages & Resources now takes courseId. Its callers are the course-app settings plugins (ORA, progress, teams, wiki) through useAppSetting. They ask for forceOnFlexiblePeerOpenassessments, disableProgressGraph, teamsConfiguration and allowPublicWikiAccess, which snakeCase maps back to the server names exactly.
  • Tested against mocks shaped from the platform PR's serializers; the platform PR is not merged yet.
  • No migrations, no accessibility impact.

Best Practices Checklist

  • Any new files are using TypeScript (.ts, .tsx).
  • Avoid propTypes and defaultProps in any new or modified code.
  • Tests should use the helpers in src/testUtils.tsx (specifically initializeMocks)
  • Do not add new fields to the Redux state/store. Use React Context to share state among multiple components.
  • Use React Query to load data from REST APIs. See any apiHooks.ts in this repo for examples.
  • All new i18n messages in messages.ts files have a description for translators to use. (None added.)
  • Avoid using ../ in import paths. To import from parent folders, use @src, e.g. import { initializeMocks } from '@src/testUtils'; instead of from '../../../../testUtils'

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 17, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @taimoor-ahmed-1!

This repository is currently maintained by @bradenmacdonald.

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.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


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.

The Advanced Settings page, the Pages & Resources settings API and the
problem editor's defaults read GET/PATCH
/api/contentstore/v0/advanced_settings/{course_id}, which
openedx-platform#39303 superseded with GET/PATCH
/api/authoring/v1/courses/{course_key}/advanced_settings/.

- Advanced Settings reads the default view, the editable set that
  ?fetch_all=0 returned. A refused update is reported in the standard
  error body, whose errors member maps each setting name to its messages;
  getAdvancedSettingsErrors turns it into the {key, message} list the
  error modal shows. The v0 body nested that list under
  developer_message, which the page never read, so the modal now lists
  the server's per-setting messages instead of none. An error tied to no
  setting (non_field_errors) is shown without a setting title.
- Pages & Resources reads view=full narrowed by fields. Its old
  filter_fields was passed as an axios config key, so it was never sent
  and every setting came back; only the requested settings come back now.
  Its callers are the course-app settings plugins (ORA, progress, teams,
  wiki), through useAppSetting.
- The problem editor no longer requests advanced settings for a v1
  (library-v1:) library key, as it already did not for lib: keys; the
  request failed for libraries on v0 too and the editor fell back to no
  defaults, which it now does without the request.
@taimoor-ahmed-1
taimoor-ahmed-1 force-pushed the taimoor-ahmed/fc0118-advanced-settings branch from 9249258 to e41e517 Compare November 17, 2026 06:42
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.39%. Comparing base (f2dab4e) to head (e41e517).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3366      +/-   ##
==========================================
+ Coverage   96.36%   96.39%   +0.03%     
==========================================
  Files        1467     1472       +5     
  Lines       36182    36474     +292     
  Branches     8692     8817     +125     
==========================================
+ Hits        34867    35160     +293     
+ Misses       1272     1258      -14     
- Partials       43       56      +13     

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

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Nov 24, 2026
@mphilbrick211 mphilbrick211 moved this from Waiting on Author to Needs Triage in Contributions Nov 24, 2026
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Nov 24, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Nov 24, 2026
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

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

3 participants