-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix: set upstream link for re-copied block from course originally from library #35784
fix: set upstream link for re-copied block from course originally from library #35784
Conversation
Thanks for the pull request, @navinkarkera! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
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.
👍 Works perfectly, great job @navinkarkera ! Left a couple of minor suggestions.
- I tested this using the instructions from the issue with the
[contentstore.new_studio_mfe.use_new_unit_page](http://local.edly.io:8000/admin/waffle/flag/43/change/)
waffle flag disabled, so I could use the legacy Studio UI to see the "update available" links. - I read through the code
-
I checked for accessibility issues by using my keyboard to navigateN/A - Includes great documentation :)
-
User-facing strings are extracted for translationN/A
* the xblock is copied from a v2 library; the library block is set as upstream. | ||
* the xblock is copied from a course; no upstream is set, only copied_from_block is set. | ||
* the xblock is copied from a course where the source block was imported from a library; the original libary block | ||
is set as upstream. |
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.
Your documentation here is so good -- it's really helpful to see all the many ways we manage links between blocks. Thank you for taking the time to explain!
if copied_from_block is None: | ||
return |
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.
[opinion] Can we make copied_from_block
a required string parameter instead of returning here? I think that would be clearer.
if copied_from_block is None: | |
return | |
assert copied_from_block |
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.
Did not add assert, but updated the type and moved the check to caller function.
# first verify link for copied block from library | ||
new_block_key = _copy_paste_and_assert_link(self.lib_block_key) | ||
# next verify link for copied block from the pasted block | ||
_copy_paste_and_assert_link(new_block_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.
Oo that's nice!
@@ -323,6 +323,58 @@ def import_staged_content_from_user_clipboard(parent_key: UsageKey, request) -> | |||
return new_xblock, notices | |||
|
|||
|
|||
def fetch_and_set_upstream_link( |
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.
This function seems pretty local to _import_xml_node_to_parent
.. should it be an internal function to discourage use outside of this module?
def fetch_and_set_upstream_link( | |
def _fetch_and_set_upstream_link( |
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.
Makes sense. Updated.
…m library Sets upstream link to library block for blocks that were copied from a course block which were originally copied/imported from a library.
bcc1fb5
to
dac4072
Compare
@@ -436,7 +465,7 @@ def _import_xml_node_to_parent( | |||
# Allow an XBlock to do anything fancy it may need to when pasted from the clipboard. | |||
# These blocks may handle their own children or parenting if needed. Let them return booleans to | |||
# let us know if we need to handle these or not. | |||
children_handed = new_xblock.studio_post_paste(store, node) | |||
children_handled = new_xblock.studio_post_paste(store, node) |
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.
Typo in variable causing children_handed
to always be False
.
if copied_from_block is None: | ||
return |
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.
Did not add assert, but updated the type and moved the check to caller function.
@@ -323,6 +323,58 @@ def import_staged_content_from_user_clipboard(parent_key: UsageKey, request) -> | |||
return new_xblock, notices | |||
|
|||
|
|||
def fetch_and_set_upstream_link( |
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.
Makes sense. Updated.
…m library (openedx#35784) Sets upstream link to library block for blocks that were copied from a course block which were originally copied/imported from a library. (cherry picked from commit d82aada)
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
2U Release Notice: This PR has been deployed to the edX production environment. |
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
2U Release Notice: This PR has been deployed to the edX production environment. |
Description
Sets upstream link to library block for blocks that were copied from a course block which were originally copied/imported from a library.
Fix for #35752
Supporting information
Private-ref
: FAL-3935Testing instructions
Follow instructions from issue: https://github.com/openedx/edx-platform/issues/35752\
Deadline
ASAP