fix: discussion tab visibility on import#38084
fix: discussion tab visibility on import#38084Anas12091101 wants to merge 2 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @Anas12091101! 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. |
Description
Problem
When a course is exported and imported (or rerun) into another course, the discussion tab's
is_hiddenstate is copied verbatim via modulestore'scourse.tabs. However,DiscussionsConfiguration.enabled, a separate Django DB model, is not carried over. It either already exists withenabled=True(created when the destination course was set up) or gets freshly created with the defaultenabled=True.This causes a desync:
course.tabs[discussion].is_hidden = True) → LMS hides the Discussion tabDiscussionsConfiguration.enabled = True) → Authoring MFE "Hide discussion tab" toggle shows OFFThe learner sees no Discussion tab, but Studio incorrectly shows it as not hidden.
Root Cause
The
course_publishedsignal handler in handlers.py creates/updatesDiscussionsConfigurationwithout consulting the modulestore tab state. The serializer's_update_course_configurationsyncstab.is_hidden↔enabled, but only on API save (POST/PATCH), never on publish or import.Fix
In
update_course_discussion_config(), before creating or updatingDiscussionsConfiguration, we now read the discussion tab'sis_hiddenfrom the published branch of modulestore and deriveenabled = not tab.is_hidden. This applies to both new and existing config paths. If the modulestore read fails,enableddefaults toTruefor backward compatibility.Useful information to include:
changes.
Supporting information
https://github.com/mitodl/hq/issues/10272
Testing instructions
Pages and Resourcesshows ON,DiscussionsConfiguration.enabledisFalseDeadline
"None"
Other information
Include anything else that will help reviewers and consumers understand the change.