Change the content block type only if the user specifies a type

This commit is contained in:
Ramon Wenger 2019-07-29 11:22:00 +02:00
parent 5ae47029a3
commit bdfd6ee510
1 changed files with 5 additions and 2 deletions

View File

@ -33,7 +33,10 @@ class MutateContentBlock(relay.ClientIDMutation):
content_block = get_object(ContentBlock, id_param)
block_type = content_block_data.get('type', content_block.type.upper())
block_type = content_block_data.get('type')
if block_type is not None: # only change the type if the user has set a type
content_block.type = set_user_defined_block_type(block_type)
module = content_block.get_parent().get_parent().specific
if visibility_list is not None:
@ -48,7 +51,7 @@ class MutateContentBlock(relay.ClientIDMutation):
if contents is not None:
content_block.contents = json.dumps([handle_content_block(c, info.context, module) for c in contents])
content_block.type = set_user_defined_block_type(block_type)
content_block.save()
return cls(content_block=content_block)