Fix bug in room contents

This commit is contained in:
Ramon Wenger 2021-12-13 16:34:11 +01:00
parent 41bbfd7177
commit dc8ec86610
2 changed files with 1 additions and 7 deletions

View File

@ -19,10 +19,7 @@ class GenericStreamFieldType(Scalar):
@staticmethod
def serialize(stream_value):
raw_data = stream_value.raw_data
return augment_fields(raw_data)
# by_api = stream_value.stream_block.get_api_representation(stream_value)
# return by_api
return list(augment_fields(raw_data))
def augment_fields(raw_data):
@ -94,4 +91,3 @@ def augment_fields(raw_data):
@convert_django_field.register(StreamField)
def convert_stream_field(field, registry=None):
return GenericStreamFieldType(description=field.help_text, required=not field.null)

View File

@ -57,7 +57,6 @@ class ContentBlockNode(DjangoObjectType, HiddenAndVisibleForMixin):
def resolve_contents(self, info, **kwargs):
updated_raw_data = []
# todo: deprecated as of wagtail 2.12 https://docs.wagtail.io/en/stable/releases/2.12.html
for content in self.contents.raw_data:
# only show solutions to teachers and students for whom their teachers have them enabled
if is_solution_and_hidden_for_user(content['type'], info.context.user, self.module):
@ -71,7 +70,6 @@ class ContentBlockNode(DjangoObjectType, HiddenAndVisibleForMixin):
content = process_module_room_slug_block(content)
updated_raw_data.append(content)
# todo: deprecated as of wagtail 2.12 https://docs.wagtail.io/en/stable/releases/2.12.html
self.contents.raw_data = updated_raw_data
return self.contents