feat: Copy object tags [FC-0062] - #236
Conversation
|
Thanks for the pull request, @ChrisChV! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
…et the serializer for tags
navinkarkera
left a comment
There was a problem hiding this comment.
👍 @ChrisChV Perfect 💯
- I tested this: (Copied tags, deleted tags, added same tag in source and dest and copied them.)
- I read through the code
- I checked for accessibility issues
- Includes documentation
|
|
||
| assert len(object_tags) == 2 | ||
| for index, object_tag in enumerate(object_tags): | ||
| object_tag.full_clean() |
There was a problem hiding this comment.
| object_tag.full_clean() |
Is full_clean required here?
bradenmacdonald
left a comment
There was a problem hiding this comment.
Suggested some changes. Thinking ahead, we may also need an API to "convert" the tags if/when the link is broken. That is, if the user links some library into a course, then later breaks the link, the tags that were read-only would need to be changed to is_copied=False so that they can be edited. But we can do that in a separate PR if you prefer.
| default=False, | ||
| help_text=_( | ||
| "True if this object tag has been copied from one object to another" | ||
| " using 'copy_tags' api function" |
There was a problem hiding this comment.
| " using 'copy_tags' api function" | |
| " using 'copy_tags' api function. Used to make copied tags read-only in the UI." |
There was a problem hiding this comment.
I think this should not be here. If the tagging app is reused in another project other than edx-platform, a copied tag does not necessarily mean it is read-only in the UI.
| """ | ||
| Convert this list of ObjectTags to the serialized dictionary, grouped by Taxonomy | ||
| """ | ||
| ObjectTagViewMinimalSerializer = self.context["view"].minimal_serilizer_class |
There was a problem hiding this comment.
What is the purpose of this, vs. just hard-coding the use of ObjectTagMinimalSerializer ?
There was a problem hiding this comment.
I do it this way so that that serializer can be overridden. In my other PR I override that serializer to override get_can_delete_objecttag and prevent the user from deleting copied tags.
There was a problem hiding this comment.
Would be good to mention this in a comment: "# Allows consumers like edx-platform to override this"
| taxonomy_id=object_tag.taxonomy_id, | ||
| tag_id=object_tag.tag_id, | ||
| defaults={"is_copied": True}, | ||
| # Note: _value and _export_id should be set automatically |
There was a problem hiding this comment.
Did you confirm this is working? (That _value and _export_id are getting set automatically?)
|
@ChrisChV I can merge this when you fix the conflicts and reply - let me know. |
|
@bradenmacdonald It's ready for merge.
Sorry I forgot this, yes, we can do this in a separate PR |

This PR adds:
copy_tagsinapi.pyto copy tags between objects.is_copiedinObjectTagSupporting information
Testing instructions
Deadline
ASAP