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

[Tagging] Handle copying tag data when duplicating XBlocks #181

Closed
yusuf-musleh opened this issue Jan 17, 2024 · 0 comments
Closed

[Tagging] Handle copying tag data when duplicating XBlocks #181

yusuf-musleh opened this issue Jan 17, 2024 · 0 comments

Comments

@yusuf-musleh
Copy link
Member

"As a content author, when I duplicate an XBlock that has tags applied, the newly created XBlock through duplication should also have the tags carried over and applied"

Acceptance Criteria
This step implements changes needed to handle the "duplicate xblock" case, as the logic slightly differs from the copy/paste case. This comes after completed the implementation for pasting XBlocks, and adds additional changes needed.

  • In the duplicate_block function, we can add a new kwarg called “with_tags=True” that will (by default) copy over the tags from the xblock (and its children if shallow=False) that is being duplicated
  • That function calls the gather_block_attributes function, which we can pass in the new with_tags kwarg, in this case we default to False so it doesnt affect other calls to this function. If set to True, we can fetch the tags for that xblock using the get_tags_content API method, similar to Step 1 and include the results in the duplicate_metadata that is returned
  • Once the new duplicated xblock is created using store.create_item, we can then apply all the returned tags to the new xblock using tag_content_object method
  • The same steps will be repeated for the children since the duplicate_block function will be called recursively, so it handles that case if we pass in the same with_tags kwarg value.
  • Implement tests to verify this was implemented correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants