Skip to content

feat: allow block publish if was published before Library v2 migration#38865

Open
asadali145 wants to merge 1 commit into
openedx:masterfrom
mitodl:asad/v1-v2-lib-migration-fixes-and-command
Open

feat: allow block publish if was published before Library v2 migration#38865
asadali145 wants to merge 1 commit into
openedx:masterfrom
mitodl:asad/v1-v2-lib-migration-fixes-and-command

Conversation

@asadali145

@asadali145 asadali145 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds the ability to publish a library content block if it was published before the V2 migration. This would be helpful for anyone having too many courses and libraries.

Testing instructions

  • Checkout mater branch
  • Create a legacy library and use it in a course.
  • Go to the content -> library update -> Review content updates and update the library references.
  • Go to the Unit with library content and notice that it is in draft.
  • Now checkout this branch and update the falg defaults to True and repeat the above steps. It should publish the block.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 9, 2026
@openedx-webhooks

openedx-webhooks commented Jul 9, 2026

Copy link
Copy Markdown

Thanks for the pull request, @asadali145!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Jul 9, 2026
@asadali145
asadali145 force-pushed the asad/v1-v2-lib-migration-fixes-and-command branch from 4db4e90 to 4f8a913 Compare July 9, 2026 10:30
@asadali145
asadali145 marked this pull request as ready for review July 9, 2026 11:12
Comment thread cms/djangoapps/contentstore/tasks.py Outdated
Comment thread xmodule/library_content_block.py Outdated
Comment thread xmodule/tests/test_library_content.py Outdated
@asadali145
asadali145 force-pushed the asad/v1-v2-lib-migration-fixes-and-command branch from 4f8a913 to b59b9e4 Compare July 9, 2026 15:25
@asadali145
asadali145 requested a review from arslanashraf7 July 9, 2026 15:26
@asadali145
asadali145 force-pushed the asad/v1-v2-lib-migration-fixes-and-command branch from b59b9e4 to 1962ae8 Compare July 9, 2026 15:26
@asadali145

Copy link
Copy Markdown
Contributor Author

@arslanashraf7 this should be good for another look.

@arslanashraf7 arslanashraf7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@pdpinch

pdpinch commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Does this need Product review? I feel like @jmakowski1123 told me once that there was some concern about having blocks published as part of the migration process.

@asadali145

Copy link
Copy Markdown
Contributor Author

Does this need Product review? I feel like @jmakowski1123 told me once that there was some concern about having blocks published as part of the migration process.

@pdpinch, we are not changing the default behavior. It is still the same after the changes.

I would like to know more about the concerns about publishing the migrated blocks.

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Jul 13, 2026
@ormsbee

ormsbee commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Also FYI @kdmccormick

@kdmccormick kdmccormick left a comment

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 can see the value in reducing number of clicks authors need to do in order to migrate, but I am wary of introducing a bug by publishing in non-standard way.

Comment thread xmodule/library_content_block.py Outdated
Comment thread xmodule/library_content_block.py
Comment thread cms/djangoapps/contentstore/tasks.py
@asadali145
asadali145 force-pushed the asad/v1-v2-lib-migration-fixes-and-command branch from 1962ae8 to 3b9c887 Compare July 14, 2026 16:38
@asadali145
asadali145 requested a review from kdmccormick July 16, 2026 09:55
@kdmccormick
kdmccormick marked this pull request as draft July 17, 2026 17:08
@kdmccormick

Copy link
Copy Markdown
Member

Marking as Draft so that the management command can be added.

@asadali145
asadali145 force-pushed the asad/v1-v2-lib-migration-fixes-and-command branch 3 times, most recently from cdec8f2 to c9538c3 Compare July 21, 2026 09:04
@asadali145
asadali145 marked this pull request as ready for review July 21, 2026 09:05
@asadali145
asadali145 requested a review from Copilot July 21, 2026 09:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an opt-in path for the legacy library-content-block → Library v2 migration flow to keep already-published legacy library content blocks published by re-publishing them after upstream references are updated, plus a Studio management command to dispatch migrations for selected/all courses.

Changes:

  • Add persist_publish_state flag to LegacyLibraryContentBlock.v2_update_children_upstream_version to optionally re-publish after migration updates.
  • Thread the new flag through the existing Celery migration task.
  • Introduce a Studio management command (and tests) to dispatch the migration task for specific courses or all courses.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
xmodule/library_content_block.py Adds persist_publish_state behavior to optionally re-publish migrated blocks.
cms/djangoapps/contentstore/tasks.py Extends the migration task to accept/forward persist_publish_state.
cms/djangoapps/contentstore/management/commands/migrate_course_legacy_library_blocks_to_item_bank.py New management command to queue migrations for course lists or all courses.
cms/djangoapps/contentstore/management/commands/tests/test_migrate_course_legacy_library_blocks_to_item_bank.py Tests management command option validation and task dispatch arguments.
xmodule/tests/test_library_content.py Adds coverage for publishing behavior under different prior-publish/flag combinations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread xmodule/library_content_block.py Outdated
Comment thread cms/djangoapps/contentstore/tasks.py Outdated
Comment thread cms/djangoapps/contentstore/tasks.py Outdated
@asadali145
asadali145 force-pushed the asad/v1-v2-lib-migration-fixes-and-command branch from c9538c3 to d49e237 Compare July 21, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

8 participants