Update channel logic to support publishing channel draft#5241
Conversation
update tests for publish draft using main tree Enhanced publish functionality to support three publish types fixed fix frontend tests
AlexVelezLl
left a comment
There was a problem hiding this comment.
Thanks a lot @taoerman! This looks great! I've manually tested, and the whole workflow is working fine when publishing a draft studio channel! I have left just a couple of nitpick comments, nothing blocking
| } | ||
| this.setAndValidateBoolean(use_staging_tree, 'use_staging_tree'); | ||
| this.setAndValidateIsDefined(version_notes, 'version_notes'); | ||
| this.setAndValidateIsDefined(language, 'language'); |
There was a problem hiding this comment.
Seems like we are not using the version_notes nor the language in the publish_channel method for draft channels, so perhaps it is not needed to receive them here?
| }, | ||
|
|
||
| publishDraft(id) { | ||
| publishDraft(id, use_staging_tree=false, version_notes="") { |
There was a problem hiding this comment.
(Nitpick) Could we add these two optional variables in an object, to pass them as named arguments? This way is clearer what is the true for when we call this method.
Channel.publishDraft(context.state.currentChannelId, { use_staging_tree: true })| target_paths = [ | ||
| os.path.join(settings.DB_ROOT, "{}-{}.sqlite3".format(channel_id, version)) | ||
| ] | ||
| # Only create non-version path if not using the staging tree |
There was a problem hiding this comment.
I think, we should also update this comment now that the condition has changed.
|
Hi @AlexVelezLl , I've fixed the code according to your comments. Thanks for your review! |
AlexVelezLl
left a comment
There was a problem hiding this comment.
Thanks @taoerman!! This looks great! 🎉
9cba74b
into
learningequality:community-channels
Summary
Enhanced publish functionality to support three publish types using is_draft_version and use_staging_tree parameters. Added ability to publish main tree content as drafts without marking content as published. For draft publishes (both staging and main tree), content remains in unpublished state - only regular publish marks content as published.
Manual verification: Tested publish draft functionality using main tree, verified only {channel_id}-next.sqlite3 file is created, confirmed channel version is not incremented, and main tree remains unpublished after draft publish.
References
#5192
Reviewer guidance
Run unit tests. Test existing publish and staging tree publish are not affected.