Repository navigation
feat: include children info in xblock api #33977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -178,6 +178,16 @@ def handle_xblock(request, usage_key_string=None): | |||
| xblock, is_concise=True | ||||
| ) | ||||
| return JsonResponse(ancestor_info) | ||||
| elif "childrenInfo" in fields: | ||||
| xblock = get_xblock(usage_key, request.user) | ||||
| children_info = _create_xblock_child_info( | ||||
| xblock, | ||||
| course_outline=None, | ||||
| graders=None, | ||||
| include_children_predicate=ALWAYS, | ||||
| is_concise=True | ||||
| ) | ||||
| return JsonResponse(children_info) | ||||
| # TODO: pass fields to get_block_info and only return those | ||||
| with modulestore().bulk_operations(usage_key.course_key): | ||||
| response = get_block_info(get_xblock(usage_key, request.user)) | ||||
|
|
@@ -824,14 +834,16 @@ def get_block_info( | |||
| xblock, | ||||
| rewrite_static_links=True, | ||||
| include_ancestor_info=False, | ||||
| include_child_info=False, | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
unused parameter?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ty, I forgot to take this back out |
||||
| include_publishing_info=False, | ||||
| include_children_predicate=False, | ||||
| include_children_predicate=NEVER, | ||||
| ): | ||||
| """ | ||||
| metadata, data, id representation of a leaf block fetcher. | ||||
| :param usage_key: A UsageKey | ||||
| """ | ||||
| with modulestore().bulk_operations(xblock.location.course_key): | ||||
| category = getattr(xblock, "category", "") | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
unused variable?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. forgot to remove this as well |
||||
| data = getattr(xblock, "data", "") | ||||
| if rewrite_static_links: | ||||
| data = replace_static_urls(data, None, course_id=xblock.location.course_key) | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better, thanks 👍🏻