-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: store copied block tags in StagedContent.tags
Adds a new JSON field to StagedContent to store a dict of serialized object tags from the copied block and its children, if any. These tags are deserialized and applied to the new block(s) on paste. To support this, we had to make 2 changes to XBlockSerializer: * XBlockSerializer now serializes the block's (and it's child block's) tags into a dict, keyed off the block usage key. These serialized tags are stored in StagedContent.tags * XBlockSerializer now inserts a url_name attribute when serializing blocks that don't provide one. When pasting serialized blocks, the url_name is used to reconstruct the original usage keys of any serialized children, so we can identify their tags. Other related changes: * Updates import_staged_content_from_user_clipboard's helper method to reconstruct child usage keys, so we can determine which tags apply to the pasted block(s). * Updates ClipboardPasteTestCase to test copying child tags * Removes TaggedBlockMixin, and moves its object tag serialization logic into content_tagging.api
- Loading branch information
1 parent
16192fc
commit 7702971
Showing
15 changed files
with
260 additions
and
178 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
19 changes: 19 additions & 0 deletions
19
openedx/core/djangoapps/content_staging/migrations/0004_stagedcontent_tags.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 4.2.10 on 2024-03-21 23:42 | ||
|
||
from django.db import migrations | ||
import jsonfield.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('content_staging', '0003_olx_unicode'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='stagedcontent', | ||
name='tags', | ||
field=jsonfield.fields.JSONField(help_text='Content tags applied to these blocks', null=True), | ||
), | ||
] |
This file contains 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
This file contains 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
Oops, something went wrong.