Prevent backend from changing a block’s type
This commit is contained in:
parent
f3db3c6657
commit
d80abf5b09
|
|
@ -29,9 +29,10 @@ class MutateContentBlock(relay.ClientIDMutation):
|
||||||
title = content_block_data.get('title', None)
|
title = content_block_data.get('title', None)
|
||||||
contents = content_block_data.get('contents', None)
|
contents = content_block_data.get('contents', None)
|
||||||
visibility_list = content_block_data.get('visibility', 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)
|
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
|
module = content_block.get_parent().get_parent().specific
|
||||||
|
|
||||||
if visibility_list is not None:
|
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.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.type = set_user_defined_block_type(block_type)
|
||||||
|
|
||||||
content_block.save()
|
content_block.save()
|
||||||
|
|
||||||
return cls(content_block=content_block)
|
return cls(content_block=content_block)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue