fix: restore republish on unit visibility change from outline configure modal#3026
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. |
| */ | ||
| export async function configureCourseUnit(variables: ConfigureUnitData): Promise<object> { | ||
| const body = { | ||
| publish: variables.groupAccess ? null : variables.type, |
There was a problem hiding this comment.
@navinkarkera, I am not sure if this was an intentional change in 806135e#diff-d8acab706381e84f07184d02fabb56bdd3c592155995f442f50fdd56493fba52R313. Could you please confirm?
There was a problem hiding this comment.
@Anas12091101 Actually, I updated this to match and remove duplicate configure course unit visibility api function: here
This means that before it was not consistent, changing visibility from unit page required a publish while changing visibility from outline did not.
There was a problem hiding this comment.
@navinkarkera, has there been a decision to require publishing from the outline page? If so, could you point me to the relevant discussion or reference?
Also, the check variables.groupAccess ? null : variables.type will evaluate to null even when groupAccess is an empty object ({}). Is that intentional?
There was a problem hiding this comment.
has there been a decision to require publishing from the outline page? If so, could you point me to the relevant discussion or reference?
@Anas12091101 Nope, I just shared why this change came into picture. I don't mind it in either way (auto publish or not), so no objections to this PR.
Also, the check variables.groupAccess ? null : variables.type will evaluate to null even when groupAccess is an empty object ({}). Is that intentional?
No, like I said, it was copied/moved over from duplicate function from unit page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3026 +/- ##
========================================
Coverage 95.47% 95.47%
========================================
Files 1381 1381
Lines 32563 32565 +2
Branches 7228 7445 +217
========================================
+ Hits 31088 31090 +2
+ Misses 1419 1406 -13
- Partials 56 69 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bradenmacdonald
left a comment
There was a problem hiding this comment.
Thanks, especially for the nice testing instructions! Sorry for the delay in reviewing this. If you don't mind opening a backport PR, I'll be happy to merge that too.
Description
Commit 806135e introduced a ternary that set
publish: nullwhengroupAccesswas truthy. Since the configure modal always passesgroupAccessas{}(an empty object, which is truthy in JS),publishwas never set to"republish". The backend requirespublish: "republish"to auto-publish visibility changes for units that already have a published version, so changes were silently saved to draft only, requiring a manual publish step to take effect for learners.Useful information to include:
Before
Screen.Recording.2026-04-24.at.8.01.45.PM.mov
After
Screen.Recording.2026-04-24.at.8.05.37.PM.mov
Supporting information
Link to other information about the change, such as GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.
Testing instructions
Pre-conditions: A course with at least one unit that has already been published.
Steps:
Verify the fix is absent (regression check on the broken behavior):
Also test the reverse:
Also test group access (ensure no regression):
Other information
Include anything else that will help reviewers and consumers understand the change.
Best Practices Checklist
We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:
.ts,.tsx).propTypesanddefaultPropsin any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use.../in import paths. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'