Skip to content

Commit d23244a

Browse files
fix: don't update the 'collections' field of deleted entities when modifying a collection
1 parent 6dba1fe commit d23244a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • openedx/core/djangoapps/content_libraries

openedx/core/djangoapps/content_libraries/tasks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ def send_collections_changed_events(
276276
"""
277277
Sends a CONTENT_OBJECT_ASSOCIATIONS_CHANGED event for each modified library
278278
entity in the given list, because their associated collections have changed.
279+
This is dispatched in response to a COLLECTION_CHANGED event, usually
280+
because entities have been added to or removed from a collection.
279281
280282
⏳ This task is designed to be run asynchronously so it can handle many
281283
entities, but you can also call it synchronously if you are only
@@ -287,6 +289,8 @@ def send_collections_changed_events(
287289
entities = (
288290
content_api.get_publishable_entities(learning_package_id)
289291
.filter(id__in=publishable_entity_ids)
292+
# Ignore deleted items (both draft & published are deleted) that are still associated with the collection:
293+
.exclude(draft__version=None, published__version=None)
290294
.select_related("component", "container")
291295
)
292296

0 commit comments

Comments
 (0)