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

fix: store tags in TaggedBlockMixin.tags_v1 field #640

Conversation

pomegranited
Copy link
Member

@pomegranited pomegranited commented Mar 1, 2024

Previously, we relied on the presence of the xml_attributes field, which is added by the XmlMixin. However, XmlMixin is not part of the default XBLOCK_MIXINS (because not all XBlocks support this), and so custom XBlocks weren't able to copy/paste tags.

This change maintains support for the tags-v1 OLX attribute by adding a field with that name.

Testing instructions

  1. Install this branch in your devstack.
  2. Downgrade the ORA2 requirement to prior to feat: deserialize tag info from xml [FC-0049] openedx/edx-ora2#2181: pip install edx-ora2==6.1.0
  3. In Studio, create a course with Text, Open Assessment, and Drag-and-Drop-v2 blocks.
  4. Add tags to those blocks.
  5. Ensure that you can copy/paste these blocks to a different area of the course, and that tags are copied too.
  6. Ensure that you can duplicate these blocks, and that tags are duplicated too.

Previously, we relied on the presence of the xml_attributes field, which
is added by the XMLMixin. However, XMLMixin is not part of the default
XBLOCK_MIXINS, so custom XBlocks weren't able to copy/paste tags.
# Serialize and add tag data if any
if isinstance(block, TaggedBlockMixin):
block.add_tags_to_node(olx_node)

Copy link
Member Author

@pomegranited pomegranited Mar 1, 2024

Choose a reason for hiding this comment

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

This step was missing for normal blocks, and so they weren't getting their tags serialized, only HTML blocks were.

@rpenido
Copy link
Member

rpenido commented Mar 1, 2024

Thank you for this @pomegranited! I cherry-picked your commit in the other branch.

@rpenido rpenido closed this Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants