Skip to content
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

feat: include children info in xblock api #33977

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -824,14 +824,16 @@ def get_block_info(
xblock,
rewrite_static_links=True,
include_ancestor_info=False,
include_child_info=False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
include_child_info=False,

unused parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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", "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
category = getattr(xblock, "category", "")

unused variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)
Expand All @@ -843,14 +845,25 @@ def get_block_info(
modulestore().get_course(xblock.location.course_key, depth=None)
)

# Note that children aren't being returned until we have a use case.
xblock_info = create_xblock_info(
xblock,
data=data,
metadata=own_metadata(xblock),
include_ancestor_info=include_ancestor_info,
include_children_predicate=include_children_predicate
)
# Note that children are returned for library_content blocks.
if category == "library_content":
xblock_info = create_xblock_info(
xblock,
data=data,
metadata=own_metadata(xblock),
include_ancestor_info=include_ancestor_info,
include_child_info=True,
include_children_predicate=ALWAYS
)
else:
xblock_info = create_xblock_info(
xblock,
data=data,
metadata=own_metadata(xblock),
include_ancestor_info=include_ancestor_info,
include_child_info=include_child_info,
include_children_predicate=include_children_predicate
)
if include_publishing_info:
add_container_page_publishing_info(xblock, xblock_info)

Expand Down
Loading