-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat: Add unlinkable to xblock actions and update top_level_parent_key on unlink [FC-0097]
#37215
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
Merged
ChrisChV
merged 9 commits into
openedx:master
from
open-craft:rpenido/fal-4225/unlink-downstream
Aug 28, 2025
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d8ba6df
feat: Add `unlinkable` to xblock actions and update `top_level_parent…
rpenido fbe9236
docs: fix docstring
rpenido e2ecce1
fix: revert unwanted change
rpenido cb40abb
fix: _update_children_top_level_parent return type
rpenido 802b5f7
feat: add unlink menu to studio_xblock_wrapper
rpenido f86ef8a
fix: docstring
rpenido 5bf33e0
fix: unlink menu text
rpenido 4abcae4
test: fix test name
rpenido 23e4eb4
Merge branch 'master' into rpenido/fal-4225/unlink-downstream
ChrisChV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2385,7 +2385,7 @@ def get_xblock_render_context(request, block): | |
| return "" | ||
|
|
||
|
|
||
| def _create_or_update_component_link(course_key: CourseKey, created: datetime | None, xblock): | ||
| def _create_or_update_component_link(created: datetime | None, xblock): | ||
|
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. The changes in this file are not related to the PR. We can get the |
||
| """ | ||
| Create or update upstream->downstream link for components in database for given xblock. | ||
| """ | ||
|
|
@@ -2399,7 +2399,7 @@ def _create_or_update_component_link(course_key: CourseKey, created: datetime | | |
| top_level_parent_usage_key = None | ||
| if xblock.top_level_downstream_parent_key is not None: | ||
| top_level_parent_usage_key = BlockUsageLocator( | ||
| course_key, | ||
| xblock.usage_key.course_key, | ||
| xblock.top_level_downstream_parent_key.get('type'), | ||
| xblock.top_level_downstream_parent_key.get('id'), | ||
| ) | ||
|
|
@@ -2408,7 +2408,7 @@ def _create_or_update_component_link(course_key: CourseKey, created: datetime | | |
| lib_component, | ||
| upstream_usage_key=upstream_usage_key, | ||
| upstream_context_key=str(upstream_usage_key.context_key), | ||
| downstream_context_key=course_key, | ||
| downstream_context_key=xblock.usage_key.course_key, | ||
| downstream_usage_key=xblock.usage_key, | ||
| top_level_parent_usage_key=top_level_parent_usage_key, | ||
| version_synced=xblock.upstream_version, | ||
|
|
@@ -2417,7 +2417,7 @@ def _create_or_update_component_link(course_key: CourseKey, created: datetime | | |
| ) | ||
|
|
||
|
|
||
| def _create_or_update_container_link(course_key: CourseKey, created: datetime | None, xblock): | ||
| def _create_or_update_container_link(created: datetime | None, xblock): | ||
| """ | ||
| Create or update upstream->downstream link for containers in database for given xblock. | ||
| """ | ||
|
|
@@ -2431,7 +2431,7 @@ def _create_or_update_container_link(course_key: CourseKey, created: datetime | | |
| top_level_parent_usage_key = None | ||
| if xblock.top_level_downstream_parent_key is not None: | ||
| top_level_parent_usage_key = BlockUsageLocator( | ||
| course_key, | ||
| xblock.usage_key.course_key, | ||
| xblock.top_level_downstream_parent_key.get('type'), | ||
| xblock.top_level_downstream_parent_key.get('id'), | ||
| ) | ||
|
|
@@ -2440,7 +2440,7 @@ def _create_or_update_container_link(course_key: CourseKey, created: datetime | | |
| lib_component, | ||
| upstream_container_key=upstream_container_key, | ||
| upstream_context_key=str(upstream_container_key.context_key), | ||
| downstream_context_key=course_key, | ||
| downstream_context_key=xblock.usage_key.course_key, | ||
| downstream_usage_key=xblock.usage_key, | ||
| version_synced=xblock.upstream_version, | ||
| top_level_parent_usage_key=top_level_parent_usage_key, | ||
|
|
@@ -2449,19 +2449,19 @@ def _create_or_update_container_link(course_key: CourseKey, created: datetime | | |
| ) | ||
|
|
||
|
|
||
| def create_or_update_xblock_upstream_link(xblock, course_key: CourseKey, created: datetime | None = None) -> None: | ||
| def create_or_update_xblock_upstream_link(xblock, created: datetime | None = None) -> None: | ||
| """ | ||
| Create or update upstream->downstream link in database for given xblock. | ||
| """ | ||
| if not xblock.upstream: | ||
| return None | ||
| try: | ||
| # Try to create component link | ||
| _create_or_update_component_link(course_key, created, xblock) | ||
| _create_or_update_component_link(created, xblock) | ||
| except InvalidKeyError: | ||
| # It is possible that the upstream is a container and UsageKeyV2 parse failed | ||
| # Create upstream container link and raise InvalidKeyError if xblock.upstream is a valid key. | ||
| _create_or_update_container_link(course_key, created, xblock) | ||
| _create_or_update_container_link(created, xblock) | ||
|
|
||
|
|
||
| def get_previous_run_course_key(course_key): | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.