feat: duplicate tags when duplicating a tagged XBlock. - #637
Merged
rpenido merged 2 commits intoFeb 29, 2024
Merged
Conversation
yusuf-musleh
approved these changes
Feb 28, 2024
yusuf-musleh
left a comment
There was a problem hiding this comment.
@pomegranited Looks good to me, thanks for taking this over! 👍
- I tested this: I tested duplicating units and blocks contains tags though both studio and the new mfe, and confirmed that the tags including children's tags have been duplicated
- I read through the code
-
I checked for accessibility issues -
Includes documentation -
I made sure any change in configuration variables is reflected in the corresponding client'sconfiguration-securerepository.
Author
|
Hi @rpenido, I'd like to merge this into your open PR branch for openedx#34270. Is that ok with you? Feel free to hit "Squash and Merge" when you're ready. |
rpenido
merged commit Feb 29, 2024
f1c806f
into
rpenido/fal-3621-paste-tags-when-pasting-xblocks-with-tag-data
Member
|
Sure @pomegranited! Done! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Updates the TaggedBlockMixin to add a
studio_post_duplicatehandler which copies the tags on thesource_itemto the duplicated block.More information
Closes openedx/modular-learning#181
Depends on
Private ref: FAL-3623
Testing instructions
Author Notes & Concerns
The implementation plan sketched out in openedx/modular-learning#181 has a flaw: When I tried storing the tag data in
duplicate_metadata, eventuallymodulestore.create_itemcalls partition_fields_by_scope, which tries to callfield = getattr(cls, 'tags-v1'). This errors out becausetags-v1isn't a real XBlock field.We could fix this by refactoring TaggedBlockMixin to use a proper XBlock field for the tag data (and since we can't have a class attribute with a hyphen in it, we'd need to rename the field from
tags-v1totags_v1).Instead, I chose to use the XBlock
studio_post_duplicatehandler, as shown. A disadvantage of this approach is there's no good way to disable duplicating content tags when duplicating an XBlock; content tags will always be duplicated too.