Skip to content
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

Publish Component Button #1353

Open
jmakowski1123 opened this issue Oct 1, 2024 · 4 comments
Open

Publish Component Button #1353

jmakowski1123 opened this issue Oct 1, 2024 · 4 comments

Comments

@jmakowski1123
Copy link

jmakowski1123 commented Oct 1, 2024

The Publish component button (in the manage tab of the component sidebar) should be clickable in the following scenarios:

  • When a new component has been created and saved
  • When a component has been modified and saved

The Publish component button should not be clickable (grayed out, but still visible) in the following scenarios:

  • When a component has not been modified since the last time it was published

Expected behavior:

  • When the Publish button is clicked, the component is available for reuse in courses.
  • Content that has never been published is not available for reuse in courses.
  • Content that has been published, later modified but not republished is not available in its modified version for reuse in courses, but the previously published version is available.

Syncing:

@ormsbee
Copy link
Contributor

ormsbee commented Oct 15, 2024

There's no Learning Core API to publish exactly one thing, but publish_drafts accepts a QuerySet of Drafts. So with no changes to openedx-learning, we could do something like:

pe_key = pe_key_from_usage_key(usage_key)  # I'm just making this up, but we have a mapping somewhere
drafts_to_publish = authoring.get_all_drafts(learning_package_id).filter(entity__key=pe_key)
authoring.publish_drafts(learning_package_id, drafts_to_publish, published_by=user.id)

@DanielVZ96
Copy link
Contributor

DanielVZ96 commented Oct 16, 2024

@ormsbee I think you mean publish_from_drafts? there's a publish_all_drafts in the public learning core API, but publish_from_drafts isn't public, it's just available for internal learning core apps. I can still do from openedx_learning.apps.authoring.publishing.api import publish_from_drafts, but I guess it'd be better to add it to the exported functions inside __all__ right?

@ormsbee
Copy link
Contributor

ormsbee commented Oct 16, 2024

@DanielVZ96: Yes, I meant publish_from_drafts, and I had forgotten that it wasn't public. Please feel free to tag me on the openedx-learning PR to make it public. Thank you.

DanielVZ96 added a commit to open-craft/openedx-learning that referenced this issue Oct 17, 2024
This function is needed for publishing single components and is
specifically required for openedx/frontend-app-authoring#1353.
ormsbee pushed a commit to openedx/openedx-learning that referenced this issue Oct 17, 2024
feat: make publish_from_drafts public (version to 0.16.1)

This function is needed for publishing single components and is
specifically required for openedx/frontend-app-authoring#1353.
@bradenmacdonald
Copy link
Contributor

@jmakowski1123 @sdaitzman @marcotuts This is ready for AC testing on the sandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready for AC testing
Development

No branches or pull requests

4 participants