diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index a15d4f6966c7..22a84b567049 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -728,7 +728,7 @@ lazy==1.6 # lti-consumer-xblock # ora2 # xblock -lti-consumer-xblock==10.0.1 +lti-consumer-xblock @ git+https://github.com/open-craft/xblock-lti-consumer.git@rpenido/FAL-4322/new-editor-design # via -r requirements/edx/kernel.in lxml[html-clean]==5.3.2 # via @@ -850,6 +850,7 @@ openedx-events==11.1.0 # edx-event-bus-kafka # edx-event-bus-redis # event-tracking + # lti-consumer-xblock # openedx-core # ora2 openedx-filters==3.1.0 diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index de4aa9bdda23..4a9b797ef1fb 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -1206,7 +1206,7 @@ libsass==0.10.0 # via # -c requirements/constraints.txt # -r requirements/edx/assets.txt -lti-consumer-xblock==10.0.1 +lti-consumer-xblock @ git+https://github.com/open-craft/xblock-lti-consumer.git@rpenido/FAL-4322/new-editor-design # via # -r requirements/edx/doc.txt # -r requirements/edx/testing.txt @@ -1411,6 +1411,7 @@ openedx-events==11.1.0 # edx-event-bus-kafka # edx-event-bus-redis # event-tracking + # lti-consumer-xblock # openedx-core # ora2 openedx-filters==3.1.0 diff --git a/requirements/edx/doc.txt b/requirements/edx/doc.txt index 11dacbbedfb9..92ca1603a909 100644 --- a/requirements/edx/doc.txt +++ b/requirements/edx/doc.txt @@ -886,7 +886,7 @@ lazy==1.6 # lti-consumer-xblock # ora2 # xblock -lti-consumer-xblock==10.0.1 +lti-consumer-xblock @ git+https://github.com/open-craft/xblock-lti-consumer.git@rpenido/FAL-4322/new-editor-design # via -r requirements/edx/base.txt lxml[html-clean]==5.3.2 # via @@ -1029,6 +1029,7 @@ openedx-events==11.1.0 # edx-event-bus-kafka # edx-event-bus-redis # event-tracking + # lti-consumer-xblock # openedx-core # ora2 openedx-filters==3.1.0 diff --git a/requirements/edx/kernel.in b/requirements/edx/kernel.in index 26448abf177d..55d8132c1bc8 100644 --- a/requirements/edx/kernel.in +++ b/requirements/edx/kernel.in @@ -101,7 +101,7 @@ jsonfield # Django model field for validated JSON; use laboratory # Library for testing that code refactors/infrastructure changes produce identical results importlib_metadata # Used to access entry_points in i18n_api plugin lxml[html_clean] # XML parser -lti-consumer-xblock>=9.14.2 +lti-consumer-xblock @ git+https://github.com/open-craft/xblock-lti-consumer.git@rpenido/FAL-4322/new-editor-design mako # Primary template language used for server-side page rendering Markdown # Convert text markup to HTML; used in capa problems, forums, and course wikis meilisearch # Library to access Meilisearch search engine (will replace ElasticSearch) diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 2103c5405005..7b215018c552 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -925,7 +925,7 @@ lazy==1.6 # lti-consumer-xblock # ora2 # xblock -lti-consumer-xblock==10.0.1 +lti-consumer-xblock @ git+https://github.com/open-craft/xblock-lti-consumer.git@rpenido/FAL-4322/new-editor-design # via -r requirements/edx/base.txt lxml[html-clean]==5.3.2 # via @@ -1076,6 +1076,7 @@ openedx-events==11.1.0 # edx-event-bus-kafka # edx-event-bus-redis # event-tracking + # lti-consumer-xblock # openedx-core # ora2 openedx-filters==3.1.0 diff --git a/xmodule/modulestore/__init__.py b/xmodule/modulestore/__init__.py index 1e83e7e57162..e75f720bc376 100644 --- a/xmodule/modulestore/__init__.py +++ b/xmodule/modulestore/__init__.py @@ -1425,3 +1425,10 @@ def _emit_item_deleted_signal(self, usage_key, user_id): """ if self.signal_handler: self.signal_handler.send("item_deleted", usage_key=usage_key, user_id=user_id) + + def _emit_pre_item_delete_signal(self, usage_key, user_id): + """ + Helper method used to emit the pre_item_delete signal. + """ + if self.signal_handler: + self.signal_handler.send("pre_item_delete", usage_key=usage_key, user_id=user_id) diff --git a/xmodule/modulestore/django.py b/xmodule/modulestore/django.py index 7ac4c4d7d704..6dd0addfcbc8 100644 --- a/xmodule/modulestore/django.py +++ b/xmodule/modulestore/django.py @@ -195,11 +195,19 @@ def do_my_expensive_update(course_key): course_deleted = SwitchedSignal("course_deleted") library_updated = SwitchedSignal("library_updated") item_deleted = SwitchedSignal("item_deleted") + pre_item_delete = SwitchedSignal("pre_item_delete") _mapping = { signal.name: signal for signal - in [pre_publish, course_published, course_deleted, library_updated, item_deleted] + in [ + pre_publish, + course_published, + course_deleted, + library_updated, + item_deleted, + pre_item_delete, + ] } def __init__(self, modulestore_class): diff --git a/xmodule/modulestore/split_mongo/split.py b/xmodule/modulestore/split_mongo/split.py index f429c9d14ecc..429a26561a76 100644 --- a/xmodule/modulestore/split_mongo/split.py +++ b/xmodule/modulestore/split_mongo/split.py @@ -2517,6 +2517,9 @@ def delete_item(self, usage_locator, user_id, force=False): # lint-amnesty, pyl # The supplied UsageKey is of the wrong type, so it can't possibly be stored in this modulestore. raise ItemNotFoundError(usage_locator) + # Send pre delete event signal before deleting any item + self._emit_pre_item_delete_signal(usage_locator, user_id) + with self.bulk_operations(usage_locator.course_key): original_structure = self._lookup_course(usage_locator.course_key).structure block_key = BlockKey.from_usage_key(usage_locator) diff --git a/xmodule/modulestore/tests/test_mixed_modulestore.py b/xmodule/modulestore/tests/test_mixed_modulestore.py index 6c0cdc6504d1..c12607687bde 100644 --- a/xmodule/modulestore/tests/test_mixed_modulestore.py +++ b/xmodule/modulestore/tests/test_mixed_modulestore.py @@ -1123,7 +1123,7 @@ def test_has_changes_missing_child(self, default_ms, default_branch): # check CONTENT_TAGGING_AUTO CourseWaffleFlag # Find: active_versions, 2 structures (published & draft), definition (unnecessary) # Sends: updated draft and published structures and active_versions - @ddt.data((ModuleStoreEnum.Type.split, 5, 2, 3)) + @ddt.data((ModuleStoreEnum.Type.split, 11, 2, 3)) @ddt.unpack def test_delete_item(self, default_ms, num_mysql, max_find, max_send): """ @@ -1146,7 +1146,7 @@ def test_delete_item(self, default_ms, num_mysql, max_find, max_send): # check CONTENT_TAGGING_AUTO CourseWaffleFlag # find: draft and published structures, definition (unnecessary) # sends: update published (why?), draft, and active_versions - @ddt.data((ModuleStoreEnum.Type.split, 5, 3, 3)) + @ddt.data((ModuleStoreEnum.Type.split, 11, 3, 3)) @ddt.unpack def test_delete_private_vertical(self, default_ms, num_mysql, max_find, max_send): """ @@ -1196,7 +1196,7 @@ def test_delete_private_vertical(self, default_ms, num_mysql, max_find, max_send # check CONTENT_TAGGING_AUTO CourseWaffleFlag # find: structure (cached) # send: update structure and active_versions - @ddt.data((ModuleStoreEnum.Type.split, 5, 1, 2)) + @ddt.data((ModuleStoreEnum.Type.split, 11, 1, 2)) @ddt.unpack def test_delete_draft_vertical(self, default_ms, num_mysql, max_find, max_send): """