Skip to content

Commit 647d733

Browse files
committed
feat: remove upstream links from unit child components on sync
1 parent 2f9f435 commit 647d733

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cms/djangoapps/contentstore/xblock_storage_handlers/view_handlers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,10 +524,13 @@ def create_item(request):
524524
return _create_block(request)
525525

526526

527-
def sync_library_content(created_block: XBlock, request, store):
527+
def sync_library_content(created_block: XBlock, request, store, remove_upstream_link: bool = False):
528528
upstream_key = check_and_parse_upstream_key(created_block.upstream, created_block.usage_key)
529529
if isinstance(upstream_key, LibraryUsageLocatorV2):
530530
lib_block = sync_from_upstream(downstream=created_block, user=request.user)
531+
if remove_upstream_link:
532+
# Removing upstream link from child components
533+
created_block.upstream = None
531534
static_file_notices = import_static_assets_for_library_sync(created_block, lib_block, request)
532535
store.update_item(created_block, request.user.id)
533536
else:
@@ -536,7 +539,7 @@ def sync_library_content(created_block: XBlock, request, store):
536539
with store.bulk_operations(created_block.location.context_key):
537540
children_blocks_usage_keys = []
538541
for child_block in children_blocks:
539-
notices.append(sync_library_content(child_block, request, store))
542+
notices.append(sync_library_content(child_block, request, store, remove_upstream_link=True))
540543
children_blocks_usage_keys.append(child_block.usage_key)
541544
created_block.children = children_blocks_usage_keys
542545
store.update_item(created_block, request.user.id)

0 commit comments

Comments
 (0)