diff --git a/openedx/core/djangoapps/notifications/tests/test_views.py b/openedx/core/djangoapps/notifications/tests/test_views.py index d5b2237303dc..06d615f07d7b 100644 --- a/openedx/core/djangoapps/notifications/tests/test_views.py +++ b/openedx/core/djangoapps/notifications/tests/test_views.py @@ -30,7 +30,10 @@ from openedx.core.djangoapps.notifications.models import ( CourseNotificationPreference, Notification, NotificationPreference ) -from openedx.core.djangoapps.notifications.serializers import add_non_editable_in_preference +from openedx.core.djangoapps.notifications.serializers import ( + add_info_to_notification_config, + add_non_editable_in_preference +) from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory @@ -711,6 +714,7 @@ def test_get_notification_preferences(self, role_type, role, visible_apps, hidde expected_data = exclude_inaccessible_preferences(self.default_data['data'], self.user) expected_data = add_non_editable_in_preference(expected_data) + expected_data = add_info_to_notification_config(expected_data) self.assertEqual(response.data['data'], expected_data) @@ -768,25 +772,30 @@ def test_if_data_is_correctly_aggregated(self): "web": False, "email": False, "push": False, - "email_cadence": "Daily" + "email_cadence": "Daily", + "info": "" }, "new_question_post": { "web": False, "email": False, "push": False, - "email_cadence": "Daily" + "email_cadence": "Daily", + "info": "" }, "new_instructor_all_learners_post": { "web": False, "email": False, "push": False, - "email_cadence": "Daily" + "email_cadence": "Daily", + "info": "" }, "core": { "web": False, "email": False, "push": False, - "email_cadence": "Daily" + "email_cadence": "Daily", + "info": "Notifications for responses and comments on your posts, and the ones you’re " + "following, including endorsements to your responses and on your posts." } }, "non_editable": { @@ -803,13 +812,15 @@ def test_if_data_is_correctly_aggregated(self): "web": False, "email": False, "push": False, - "email_cadence": "Daily" + "email_cadence": "Daily", + "info": "" }, "core": { "web": True, "email": True, "push": True, - "email_cadence": "Daily" + "email_cadence": "Daily", + "info": "Notifications for new announcements and updates from the course team." } }, "non_editable": { @@ -824,13 +835,15 @@ def test_if_data_is_correctly_aggregated(self): "web": False, "email": False, "push": False, - "email_cadence": "Daily" + "email_cadence": "Daily", + "info": "" }, "core": { "web": True, "email": True, "push": True, - "email_cadence": "Daily" + "email_cadence": "Daily", + "info": "Notifications for submission grading." } }, "non_editable": { diff --git a/openedx/core/djangoapps/notifications/views.py b/openedx/core/djangoapps/notifications/views.py index 57ef88cde1ef..091be365d45f 100644 --- a/openedx/core/djangoapps/notifications/views.py +++ b/openedx/core/djangoapps/notifications/views.py @@ -31,6 +31,7 @@ from .serializers import ( NotificationSerializer, UserNotificationPreferenceUpdateAllSerializer, + add_info_to_notification_config, add_non_editable_in_preference ) from .tasks import create_notification_preference @@ -323,11 +324,14 @@ def get(self, request): type_details['push'] = user_pref.push type_details['email_cadence'] = user_pref.email_cadence exclude_inaccessible_preferences(structured_preferences, request.user) + structured_preferences = add_non_editable_in_preference( + add_info_to_notification_config(structured_preferences) + ) return Response({ 'status': 'success', 'message': 'Notification preferences retrieved successfully.', 'show_preferences': get_show_notifications_tray(self.request.user), - 'data': add_non_editable_in_preference(structured_preferences) + 'data': structured_preferences }, status=status.HTTP_200_OK) def put(self, request):