From 4fe4e18216147f5bf1d9796e93f51e00e59a338a Mon Sep 17 00:00:00 2001 From: Yusuf Musleh Date: Mon, 15 Apr 2024 13:45:40 +0300 Subject: [PATCH] feat: Fix static-type issues + adjust tag_object --- .../djangoapps/content/search/tests/test_documents.py | 1 + openedx/core/djangoapps/content_tagging/api.py | 10 ++++++++-- requirements/edx/kernel.in | 1 - 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/openedx/core/djangoapps/content/search/tests/test_documents.py b/openedx/core/djangoapps/content/search/tests/test_documents.py index 899c5ca349f0..79efda11177b 100644 --- a/openedx/core/djangoapps/content/search/tests/test_documents.py +++ b/openedx/core/djangoapps/content/search/tests/test_documents.py @@ -172,4 +172,5 @@ def test_video_block_untagged(self): {"display_name": "Overview"}, ], "content": {}, + # This video has no tags. } diff --git a/openedx/core/djangoapps/content_tagging/api.py b/openedx/core/djangoapps/content_tagging/api.py index bc0bf7a34fb3..47b157c1a34e 100644 --- a/openedx/core/djangoapps/content_tagging/api.py +++ b/openedx/core/djangoapps/content_tagging/api.py @@ -294,13 +294,17 @@ def set_exported_object_tags( continue taxonomy = oel_tagging.get_taxonomy_by_export_id(str(taxonomy_export_id)) - tag_object( + oel_tagging.tag_object( object_id=content_key_str, taxonomy=taxonomy, tags=tags_values, create_invalid=True, taxonomy_export_id=str(taxonomy_export_id), ) + CONTENT_OBJECT_TAGS_CHANGED.send_event( + time=now(), + content_object=ContentObjectData(object_id=content_key_str) + ) def import_course_tags_from_csv(csv_path, course_id) -> None: @@ -374,6 +378,9 @@ def tag_object( Replaces the existing ObjectTag entries for the given taxonomy + object_id with the given list of tags, if the taxonomy can be used by the given object_id. + This is a wrapper around oel_tagging.tag_object that adds emitting the `CONTENT_OBJECT_TAGS_CHANGED` event + when tagging an object. + tags: A list of the values of the tags from this taxonomy to apply. object_tag_class: Optional. Use a proxy subclass of ObjectTag for additional @@ -397,7 +404,6 @@ def tag_object( content_object=ContentObjectData(object_id=object_id) ) - # Expose the oel_tagging APIs add_tag_to_taxonomy = oel_tagging.add_tag_to_taxonomy diff --git a/requirements/edx/kernel.in b/requirements/edx/kernel.in index a41b53b2d9ac..253926e2b385 100644 --- a/requirements/edx/kernel.in +++ b/requirements/edx/kernel.in @@ -116,7 +116,6 @@ openedx-atlas # CLI tool to manage translations openedx-calc # Library supporting mathematical calculations for Open edX openedx-django-require openedx-events # Open edX Events from Hooks Extension Framework (OEP-50) - openedx-filters # Open edX Filters from Hooks Extension Framework (OEP-50) openedx-learning # Open edX Learning core (experimental) openedx-mongodbproxy