Skip to content

fix: store tags in TaggedBlockMixin.tags_v1 field#640

Closed
pomegranited wants to merge 1 commit intorpenido/fal-3621-paste-tags-when-pasting-xblocks-with-tag-datafrom
jill/rpenido/fal-3621
Closed

fix: store tags in TaggedBlockMixin.tags_v1 field#640
pomegranited wants to merge 1 commit intorpenido/fal-3621-paste-tags-when-pasting-xblocks-with-tag-datafrom
jill/rpenido/fal-3621

Conversation

@pomegranited
Copy link

@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
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