From ca46c20abb646b8b887e3c4d999f4e069f7eb871 Mon Sep 17 00:00:00 2001 From: Eemaan Amir <57627710+eemaanamir@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:20:33 +0500 Subject: [PATCH] fix: update content reported notification (#35315) --- lms/djangoapps/discussion/django_comment_client/base/tests.py | 2 ++ lms/djangoapps/discussion/rest_api/discussions_notifications.py | 2 +- .../discussion/rest_api/tests/test_discussions_notifications.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/discussion/django_comment_client/base/tests.py b/lms/djangoapps/discussion/django_comment_client/base/tests.py index f8242efa0c9c..62af24f0ee37 100644 --- a/lms/djangoapps/discussion/django_comment_client/base/tests.py +++ b/lms/djangoapps/discussion/django_comment_client/base/tests.py @@ -1458,6 +1458,8 @@ def _test_unicode_data(self, text, mock_request): @disable_signal(views, 'comment_created') @disable_signal(views, 'comment_voted') @disable_signal(views, 'comment_deleted') +@disable_signal(views, 'comment_flagged') +@disable_signal(views, 'thread_flagged') class TeamsPermissionsTestCase(ForumsEnableMixin, UrlResetMixin, SharedModuleStoreTestCase, MockRequestSetupMixin): # Most of the test points use the same ddt data. # args: user, commentable_id, status_code diff --git a/lms/djangoapps/discussion/rest_api/discussions_notifications.py b/lms/djangoapps/discussion/rest_api/discussions_notifications.py index 7249d086cca6..21b1e27fcdf8 100644 --- a/lms/djangoapps/discussion/rest_api/discussions_notifications.py +++ b/lms/djangoapps/discussion/rest_api/discussions_notifications.py @@ -314,7 +314,7 @@ def send_reported_content_notification(self): content_type = thread_types[self.thread.type][getattr(self.thread, 'depth', 0)] context = { - 'username': self.creator.username, + 'username': self.thread.username, 'content_type': content_type, 'content': thread_body } diff --git a/lms/djangoapps/discussion/rest_api/tests/test_discussions_notifications.py b/lms/djangoapps/discussion/rest_api/tests/test_discussions_notifications.py index eeed292037d1..b4d3f3d18a0d 100644 --- a/lms/djangoapps/discussion/rest_api/tests/test_discussions_notifications.py +++ b/lms/djangoapps/discussion/rest_api/tests/test_discussions_notifications.py @@ -44,7 +44,7 @@ def _assert_send_notification_called_with(self, mock_send_notification, expected self.assertEqual(notification_type, "content_reported") self.assertEqual(context, { - 'username': 'test_user', + 'username': self.thread.username, 'content_type': expected_content_type, 'content': 'Thread body' })