From 6ce674a7a72314a2d26e6ac136b6caeeb79b7f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Mon, 10 Mar 2025 16:11:27 -0300 Subject: [PATCH] fix: set imported xblock parent (#36338) Fixes a bug in which the index document was created while pasting a component with empty breadcrumbs field. --- cms/djangoapps/contentstore/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/helpers.py b/cms/djangoapps/contentstore/helpers.py index 59bd6b5627..d2e7023c21 100644 --- a/cms/djangoapps/contentstore/helpers.py +++ b/cms/djangoapps/contentstore/helpers.py @@ -520,11 +520,11 @@ def _import_xml_node_to_parent( if xblock_class.has_children and temp_xblock.children: raise NotImplementedError("We don't yet support pasting XBlocks with children") - temp_xblock.parent = parent_key if copied_from_block: _fetch_and_set_upstream_link(copied_from_block, copied_from_version_num, temp_xblock, user) # Save the XBlock into modulestore. We need to save the block and its parent for this to work: new_xblock = store.update_item(temp_xblock, user.id, allow_not_found=True) + new_xblock.parent = parent_key parent_xblock.children.append(new_xblock.location) store.update_item(parent_xblock, user.id)