Prevent backend from changing a block’s type

This commit is contained in:
Christian Cueni 2018-10-23 10:43:32 +02:00
parent f3db3c6657
commit d80abf5b09
1 changed files with 2 additions and 2 deletions

View File

@ -29,9 +29,10 @@ class MutateContentBlock(relay.ClientIDMutation):
title = content_block_data.get('title', None)
contents = content_block_data.get('contents', None)
visibility_list = content_block_data.get('visibility', None)
block_type = content_block_data.get('type', ContentBlock.NORMAL)
content_block = get_object(ContentBlock, id_param)
block_type = content_block_data.get('type', content_block.type.upper())
module = content_block.get_parent().get_parent().specific
if visibility_list is not None:
@ -47,7 +48,6 @@ class MutateContentBlock(relay.ClientIDMutation):
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)