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] Copying Tags data when blocks are copied #179

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

[Tagging] Copying Tags data when blocks are copied #179

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

Comments

@yusuf-musleh
Copy link
Member

yusuf-musleh commented Jan 17, 2024

"As a content author, when I copy an xblock, I expect the tags to be included in the staged data (clipboard) in the agreed up serialized format in the OLX"

Following the discovery performed in #165, this is the implementation of the Copy XBlocks step. See here for more information about the OLX tags format. This also depends on #183 for the "Export ID".

Link to discovery.

Acceptance Criteria:

This step implements the changes needed to store the tags in the clipboard when an XBlock is copied:

  • The POST request handler in the content_staging view handles the request to copy content to the user’s clipboard. Within that handler, the serialize_xblock_to_olx method is called to serialize the block data utilizing the XBlockSerializer.
  • We need to modify the XBlockSerializer to account for serializing the xblock’s tags so they can also be stored in the user’s clipboard.
  • Since XBlocks could have children, we need to take in account the tags of the children as well.
  • To fetch the tags, we call the get_content_tags API method for the XBlock (and each child). (We only want to include the values of the tags along with the ID and name of the taxonomy they belong to, rather than the full ContentObjectTag instances. Values are guaranteed to be unique by the DB)
  • We need to make changes to _serialize_normal_block and _serialize_html_block since they are handled as separate cases:
    _serialize_normal_block: Internally calls the add_xml_to_node, we can override this method by creating a new CMS XBlock mixin (TaggedBlockMixin) to include the serialized tags/taxonomies by calling the method defined in the previous step. We’d then need to add the newly created mixin to XBLOCK_MIXINS (likely at the top since the order of inheritance matters).
    _serialize_html_block: Call the method defined in the previous step to serialize the tags/taxonomies
  • 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