diff --git a/lms/djangoapps/discussion/signals/handlers.py b/lms/djangoapps/discussion/signals/handlers.py index 545003b122..71ae8fea83 100644 --- a/lms/djangoapps/discussion/signals/handlers.py +++ b/lms/djangoapps/discussion/signals/handlers.py @@ -7,7 +7,6 @@ from django.dispatch import receiver from opaque_keys.edx.keys import CourseKey from django_comment_common import signals -from lms.djangoapps.discussion.config.waffle import waffle, FORUM_RESPONSE_NOTIFICATIONS from lms.djangoapps.discussion import tasks from openedx.core.djangoapps.site_configuration.models import SiteConfiguration from openedx.core.djangoapps.theming.helpers import get_current_site @@ -26,16 +25,6 @@ def send_discussion_email_notification(sender, user, post, **kwargs): log.info('Discussion: No current site, not sending notification about post: %s.', post.id) return - try: - if not current_site.configuration.get_value(ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY, False): - log_message = 'Discussion: notifications not enabled for site: %s. Not sending message about post: %s.' - log.info(log_message, current_site, post.id) - return - except SiteConfiguration.DoesNotExist: - log_message = 'Discussion: No SiteConfiguration for site %s. Not sending message about post: %s.' - log.info(log_message, current_site, post.id) - return - send_message(post, current_site) diff --git a/lms/djangoapps/discussion/tests/test_signals.py b/lms/djangoapps/discussion/tests/test_signals.py index d937a894fc..f8142dee10 100644 --- a/lms/djangoapps/discussion/tests/test_signals.py +++ b/lms/djangoapps/discussion/tests/test_signals.py @@ -2,7 +2,6 @@ from django.test import TestCase import mock from django_comment_common import signals -from lms.djangoapps.discussion.signals.handlers import ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY from openedx.core.djangoapps.site_configuration.tests.factories import SiteFactory, SiteConfigurationFactory from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag @@ -19,9 +18,6 @@ class SendMessageHandlerTestCase(TestCase): @mock.patch('lms.djangoapps.discussion.signals.handlers.get_current_site') @mock.patch('lms.djangoapps.discussion.signals.handlers.send_message') def test_comment_created_signal_sends_message(self, mock_send_message, mock_get_current_site): - site_config = SiteConfigurationFactory.create(site=self.site) - site_config.values[ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY] = True - site_config.save() mock_get_current_site.return_value = self.site signals.comment_created.send(sender=self.sender, user=self.user, post=self.post) @@ -45,24 +41,3 @@ class SendMessageHandlerTestCase(TestCase): signals.comment_created.send(sender=self.sender, user=self.user, post=self.post) self.assertFalse(mock_send_message.called) - - @mock.patch('lms.djangoapps.discussion.signals.handlers.get_current_site') - @mock.patch('lms.djangoapps.discussion.signals.handlers.send_message') - def test_comment_created_signal_msg_not_sent_without_site_config(self, mock_send_message, mock_get_current_site): - mock_get_current_site.return_value = self.site - signals.comment_created.send(sender=self.sender, user=self.user, post=self.post) - - self.assertFalse(mock_send_message.called) - - @mock.patch('lms.djangoapps.discussion.signals.handlers.get_current_site') - @mock.patch('lms.djangoapps.discussion.signals.handlers.send_message') - def test_comment_created_signal_msg_not_sent_with_site_config_disabled( - self, mock_send_message, mock_get_current_site - ): - site_config = SiteConfigurationFactory.create(site=self.site) - site_config.values[ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY] = False - site_config.save() - mock_get_current_site.return_value = self.site - signals.comment_created.send(sender=self.sender, user=self.user, post=self.post) - - self.assertFalse(mock_send_message.called) diff --git a/lms/djangoapps/discussion/tests/test_tasks.py b/lms/djangoapps/discussion/tests/test_tasks.py index 05cb4d583d..be1b3768ed 100644 --- a/lms/djangoapps/discussion/tests/test_tasks.py +++ b/lms/djangoapps/discussion/tests/test_tasks.py @@ -17,7 +17,6 @@ from django_comment_common.signals import comment_created from edx_ace.recipient import Recipient from edx_ace.renderers import EmailRenderer from edx_ace.utils import date -from lms.djangoapps.discussion.signals.handlers import ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY from lms.djangoapps.discussion.tasks import _should_send_message from openedx.core.djangoapps.content.course_overviews.tests.factories import CourseOverviewFactory from openedx.core.djangoapps.ace_common.template_context import get_base_template_context @@ -183,9 +182,6 @@ class TaskTestCase(ModuleStoreTestCase): user = mock.Mock() comment = cc.Comment.find(id=self.comment['id']).retrieve() site = Site.objects.get_current() - site_config = SiteConfigurationFactory.create(site=site) - site_config.values[ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY] = True - site_config.save() with mock.patch('lms.djangoapps.discussion.signals.handlers.get_current_site', return_value=site): comment_created.send(sender=None, user=user, post=comment)