Skip to content

Update channel logic to support publishing channel draft#5241

Merged
AlexVelezLl merged 4 commits into
learningequality:community-channelsfrom
taoerman:community-channels
Aug 8, 2025
Merged

Update channel logic to support publishing channel draft#5241
AlexVelezLl merged 4 commits into
learningequality:community-channelsfrom
taoerman:community-channels

Conversation

@taoerman
Copy link
Copy Markdown
Contributor

@taoerman taoerman commented Aug 3, 2025

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.

update

tests for publish draft using main tree

Enhanced publish functionality to support three publish types

fixed

fix frontend tests
Copy link
Copy Markdown
Member

@AlexVelezLl AlexVelezLl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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="") {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, we should also update this comment now that the condition has changed.

@taoerman
Copy link
Copy Markdown
Contributor Author

taoerman commented Aug 8, 2025

Hi @AlexVelezLl , I've fixed the code according to your comments. Thanks for your review!

Copy link
Copy Markdown
Member

@AlexVelezLl AlexVelezLl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @taoerman!! This looks great! 🎉

@AlexVelezLl AlexVelezLl merged commit 9cba74b into learningequality:community-channels Aug 8, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants