Repository navigation
fix: show staff lock on prerequisite-gated subsections - #3319
AhtishamShahid wants to merge 1 commit into
Conversation
Studio reports a subsection with a prerequisite as visibilityState "gated", even when the subsection is hidden from learners. The outline sidebar and the configure modal only checked for "staff_only", so a hidden gated subsection showed "Student Visible", and unchecking "Hide from learners" on its units had no effect because they inherit the lock. Use hasExplicitStaffLock as well.
|
Thanks for the pull request, @AhtishamShahid! 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. |
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes consistently handle explicit staff locks and include regression coverage, with no blocking issues identified; tests were not executed.
No open issues 🎉
What changed in this PR
Corrects Studio’s visibility controls for prerequisite-gated subsections that have an explicit staff lock.
Changes:
- Recognizes explicit staff locks in the sidebar and configure modal.
- Adds the lock field to the shared configuration type.
- Adds regression tests for both interfaces.
| File | Description |
|---|---|
| src/generic/configure-modal/ConfigureModal.tsx | Applies explicit locks to initial visibility and warnings. |
| src/generic/configure-modal/ConfigureModal.test.tsx | Tests hidden selection for locked, gated subsections. |
| src/data/types.ts | Exposes the optional explicit-lock field. |
| src/course-outline/outline-sidebar/info-sidebar/sharedSettings/VisibilitySection.tsx | Includes explicit locks in sidebar visibility state. |
| src/course-outline/outline-sidebar/info-sidebar/sharedSettings/VisibilitySection.test.tsx | Tests the sidebar’s staff-only state. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3319 +/- ##
========================================
Coverage 96.20% 96.20%
========================================
Files 1446 1446
Lines 35384 35385 +1
Branches 8179 8476 +297
========================================
+ Hits 34041 34043 +2
+ Misses 1301 1300 -1
Partials 42 42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
When a subsection has a prerequisite, Studio reports its
visibility_stateas"gated", even when the subsection is hidden from learners (has_explicit_staff_lock: true). The outline sidebar's Visibility setting and the configure modal only checked for"staff_only". So a hidden, gated subsection showed Student Visible, and the only sign it was hidden was the "Staff only" badge on its units.Unchecking "Hide from learners" on one of those units does nothing. The unit inherits the lock from its subsection, so it stays staff only after Save, and nothing on the page points to the subsection as the cause.
This change also treats
hasExplicitStaffLockas staff only in:VisibilitySection(outline sidebar)ConfigureModal(initial "Hide entire subsection" value and the warning)Impacts: Course Author.
Demo
Before/after on a local Tutor stack (75s, no audio):
pr-3319-before-after.mp4
Testing instructions
Other information
getItemStatuschecksvisibilityStatealone. I left that unchanged.