Skip to content

Commit

Permalink
fix: "num components" not updated when a component in a collection is…
Browse files Browse the repository at this point in the history
… discarded

The error occurs because even if the changes are discarded,
the unpublished entities remain within the collections,
so all unpublished entities must be removed from the collections.
  • Loading branch information
ChrisChV committed Oct 28, 2024
1 parent ab6d8cb commit 7c0916f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openedx/core/djangoapps/content_libraries/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,11 @@ def revert_changes(library_key):
learning_package = ContentLibrary.objects.get_by_key(library_key).learning_package
authoring_api.reset_drafts_to_published(learning_package.id)

# If a component is created within a collection and then returned to the published
# version, that component must be removed from the collection.
# All collections in the library are checked.
authoring_api.remove_unpublished_from_collections(learning_package.id)

CONTENT_LIBRARY_UPDATED.send_event(
content_library=ContentLibraryData(
library_key=library_key,
Expand Down

0 comments on commit 7c0916f

Please sign in to comment.