New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix draft lessons getting published when Course is updated #7582
Merged
Merged
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
da19d8a
Move outsite is admin
Imran92 d5fde01
Publish lessons only on course publish, not update
Imran92 ab99b76
Explain why we return when we detect it's just update call
Imran92 e42968d
Explain why we reset the flag
Imran92 18e51d0
Add changelog
Imran92 25997be
Fix old tests
Imran92 75cf1ca
Test that we don't publish draft lessons during course update
Imran92 397a263
Test that publishing course not publishing lesson when meta false
Imran92 0cbd25b
Test that flag is set during publish
Imran92 bd304e9
Test that lesson get published in subsequent immediate call
Imran92 45c7eb2
Add test that for more subsequent calls, it doesn't publish
Imran92 8eda32e
Add check for metabox save call
Imran92 cba86c2
Add test for metabox save call
Imran92 137a105
Add comments to tests
Imran92 2ac96e8
Add comments explaining course saving process
Imran92 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: fixed | ||
|
||
Lessons being automatically published when Course is updated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this comment a bit confusing. You reference a "next call" here, saying that this next call will be made after the structure is saved. But in the previous sentence, you said that this call is also not the structure saving call, so it's unclear from these comments when the call to save the structure actually happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The saving process is a bit complex :p So I was struggling a bit a capture it in small comments. Basically, when we click on Publish, GB makes a call with the markup. We are referring to it as the Publish call, this is the first call.
If you check the code here -
sensei/assets/shared/structure/structure-store.js
Line 253 in 0132d5c
sensei/assets/shared/structure/structure-store.js
Line 274 in 0132d5c
After the structure is also saved, we trigger another GB call (not a structure saving call, a same call as the first Publish call, but the difference is by this time, the Course is already published)
sensei/assets/shared/structure/structure-store.js
Line 158 in 0132d5c
And this last call is the one I am referring to in the comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the logic, but I still think the comment needs to be improved a bit to eliminate confusion for the next person. 🙂 Perhaps you could add a numbered list of the calls that are made somewhere in this function to "set the stage" so to speak, indicating which ones are always called and which ones may be called? I think it's more important for the comment to be clear than to be succinct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @donnapep ! I've rewrote all the comments here 2ac96e8 . Please LMK if you think the new structure is okay. Initally I was trying to use fewer words as I've not seen this many comments in the repo before for a function, so I was afraid if I was overdoing it :p Tried to make it clearer now