From d84453009538569f99448289a427169e2bb865b3 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Thu, 29 Sep 2022 15:32:41 +0200 Subject: [PATCH] Add copy of content block before the orignal --- server/books/managers.py | 2 +- server/books/tests/test_duplicate_content_blocks.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/books/managers.py b/server/books/managers.py index 305c8ddd..761d58b7 100644 --- a/server/books/managers.py +++ b/server/books/managers.py @@ -18,7 +18,7 @@ class ContentBlockManager(PageManager): title=f'{content_block.title} (Kopie)', type=content_block.type, ) - content_block.add_sibling(instance=new_content_block, pos='right') + content_block.add_sibling(instance=new_content_block, pos='left') revision = new_content_block.save_revision() revision.publish() new_content_block.save() diff --git a/server/books/tests/test_duplicate_content_blocks.py b/server/books/tests/test_duplicate_content_blocks.py index 12f891fb..c68e3cbb 100644 --- a/server/books/tests/test_duplicate_content_blocks.py +++ b/server/books/tests/test_duplicate_content_blocks.py @@ -74,3 +74,5 @@ class DuplicateContentBlockTestCase(SkillboxTestCase): content_blocks = chapter.get('contentBlocks') self.assertEqual(ContentBlock.objects.count(), 2) self.assertEqual(len(content_blocks), 2) + self.assertTrue('Kopie' in content_blocks[0].get('title')) + self.assertTrue('Kopie' not in content_blocks[1].get('title'))