diff --git a/cms/djangoapps/contentstore/signals/handlers.py b/cms/djangoapps/contentstore/signals/handlers.py index 1ffc5c01b2..ebf47f527f 100644 --- a/cms/djangoapps/contentstore/signals/handlers.py +++ b/cms/djangoapps/contentstore/signals/handlers.py @@ -10,7 +10,6 @@ from django.conf import settings from django.core.cache import cache from django.db import transaction from django.dispatch import receiver -from edx_toggles.toggles import SettingToggle from opaque_keys.edx.keys import CourseKey from openedx_events.content_authoring.data import ( CourseCatalogData, @@ -76,21 +75,6 @@ def locked(expiry_seconds, key): # lint-amnesty, pylint: disable=missing-functi return task_decorator -# .. toggle_name: SEND_CATALOG_INFO_SIGNAL -# .. toggle_implementation: SettingToggle -# .. toggle_default: False -# .. toggle_description: When True, sends to catalog-info-changed signal when course_published occurs. -# This is a temporary toggle to allow us to test the event bus integration; it should be removed and -# always-on once the integration is well-tested and the error cases are handled. (This is separate -# from whether the event bus itself is configured; if this toggle is on but the event bus is not -# configured, we should expect a warning at most.) -# .. toggle_use_cases: temporary -# .. toggle_creation_date: 2022-08-22 -# .. toggle_target_removal_date: 2022-10-30 -# .. toggle_tickets: https://github.com/openedx/edx-platform/issues/30682 -SEND_CATALOG_INFO_SIGNAL = SettingToggle('SEND_CATALOG_INFO_SIGNAL', default=False, module_name=__name__) - - def _create_catalog_data_for_signal(course_key: CourseKey) -> (Optional[datetime], Optional[CourseCatalogData]): """ Creates data for catalog-info-changed signal when course is published. @@ -130,12 +114,11 @@ def emit_catalog_info_changed_signal(course_key: CourseKey): """ Given the key of a recently published course, send course data to catalog-info-changed signal. """ - if SEND_CATALOG_INFO_SIGNAL.is_enabled(): - timestamp, catalog_info = _create_catalog_data_for_signal(course_key) - if catalog_info is not None: - # .. event_implemented_name: COURSE_CATALOG_INFO_CHANGED - # .. event_type: org.openedx.content_authoring.course.catalog_info.changed.v1 - COURSE_CATALOG_INFO_CHANGED.send_event(time=timestamp, catalog_info=catalog_info) + timestamp, catalog_info = _create_catalog_data_for_signal(course_key) + if catalog_info is not None: + # .. event_implemented_name: COURSE_CATALOG_INFO_CHANGED + # .. event_type: org.openedx.content_authoring.course.catalog_info.changed.v1 + COURSE_CATALOG_INFO_CHANGED.send_event(time=timestamp, catalog_info=catalog_info) @receiver(SignalHandler.course_published) diff --git a/cms/djangoapps/contentstore/signals/tests/test_handlers.py b/cms/djangoapps/contentstore/signals/tests/test_handlers.py index 2477e4c5b8..e70a62508f 100644 --- a/cms/djangoapps/contentstore/signals/tests/test_handlers.py +++ b/cms/djangoapps/contentstore/signals/tests/test_handlers.py @@ -5,7 +5,6 @@ Tests for signal handlers in the contentstore. from datetime import datetime, timezone from unittest.mock import patch -from django.test.utils import override_settings from opaque_keys.edx.locator import CourseLocator, LibraryLocator from openedx_events.content_authoring.data import CourseCatalogData, CourseScheduleData @@ -60,7 +59,6 @@ class TestCatalogInfoSignal(ModuleStoreTestCase): SignalHandler.course_published.send(TestCatalogInfoSignal, course_key=self.course_key) mock_emit.assert_called_once_with(self.course_key) - @override_settings(SEND_CATALOG_INFO_SIGNAL=True) @patch('cms.djangoapps.contentstore.signals.handlers.COURSE_CATALOG_INFO_CHANGED', autospec=True) def test_emit_regular_course(self, mock_signal): """On a normal course publish, send an event.""" @@ -71,16 +69,8 @@ class TestCatalogInfoSignal(ModuleStoreTestCase): time=now.replace(tzinfo=timezone.utc), catalog_info=self.expected_data) - @override_settings(SEND_CATALOG_INFO_SIGNAL=True) @patch('cms.djangoapps.contentstore.signals.handlers.COURSE_CATALOG_INFO_CHANGED', autospec=True) def test_ignore_library(self, mock_signal): """When course key is actually a library, don't send.""" sh.emit_catalog_info_changed_signal(LibraryLocator(org='SomeOrg', library='stuff')) mock_signal.send_event.assert_not_called() - - @override_settings(SEND_CATALOG_INFO_SIGNAL=False) - @patch('cms.djangoapps.contentstore.signals.handlers.COURSE_CATALOG_INFO_CHANGED', autospec=True) - def test_disabled(self, mock_signal): - """When toggle is disabled, don't send.""" - sh.emit_catalog_info_changed_signal(self.course_key) - mock_signal.send_event.assert_not_called() diff --git a/cms/envs/mock.yml b/cms/envs/mock.yml index 8ab3beea07..1001262683 100644 --- a/cms/envs/mock.yml +++ b/cms/envs/mock.yml @@ -705,7 +705,6 @@ RETIREMENT_STATES: - COMPLETE SECRET_KEY: test_secret_key SEGMENT_KEY: test_segment_key -SEND_CATALOG_INFO_SIGNAL: true SERVER_EMAIL: devops@example.com SESSION_COOKIE_NAME: studio_sessionid SESSION_COOKIE_SECURE: true