From f985ff78f64514d8f8f2640ce9399f6555b61162 Mon Sep 17 00:00:00 2001 From: Hassan Raza Date: Tue, 25 Mar 2025 16:45:32 +0500 Subject: [PATCH 1/3] feat: Group ora staff notifications --- .../djangoapps/notifications/base_notification.py | 6 ++++-- .../notifications/grouping_notifications.py | 15 +++++++++++++++ .../djangoapps/notifications/tests/test_views.py | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/openedx/core/djangoapps/notifications/base_notification.py b/openedx/core/djangoapps/notifications/base_notification.py index ff2cc38c84a3..5886fd383980 100644 --- a/openedx/core/djangoapps/notifications/base_notification.py +++ b/openedx/core/djangoapps/notifications/base_notification.py @@ -196,13 +196,15 @@ 'name': 'ora_staff_notification', 'is_core': False, 'info': '', - 'web': False, + 'web': True, 'email': False, 'push': False, 'email_cadence': EmailCadence.DAILY, 'non_editable': [], - 'content_template': _('<{p}>You have a new open response submission awaiting for review for ' + 'content_template': _('<{p}>You have a new open response submission awaiting review for ' '<{strong}>{ora_name}'), + 'grouped_content_template': _('<{p}>You have multiple submissions awaiting review for ' + '<{strong}>{ora_name}'), 'content_context': { 'ora_name': 'Name of ORA in course', }, diff --git a/openedx/core/djangoapps/notifications/grouping_notifications.py b/openedx/core/djangoapps/notifications/grouping_notifications.py index 0e84ea3f109a..a1da88683fa0 100644 --- a/openedx/core/djangoapps/notifications/grouping_notifications.py +++ b/openedx/core/djangoapps/notifications/grouping_notifications.py @@ -106,6 +106,21 @@ def group(self, new_notification, old_notification): } +@NotificationRegistry.register('ora_staff_notification') +class OraStaffGrouper(BaseNotificationGrouper): + """ + Grouper for new ora staff notifications. + """ + + def group(self, new_notification, old_notification): + """ + Groups new ora staff notifications based on the xblock ID. + """ + content_context = old_notification.content_context + content_context.setdefault("grouped", True) + return content_context + + def group_user_notifications(new_notification: Notification, old_notification: Notification): """ Groups user notification based on notification type and group_id diff --git a/openedx/core/djangoapps/notifications/tests/test_views.py b/openedx/core/djangoapps/notifications/tests/test_views.py index 3d1a11e713a2..af85a5f45e2d 100644 --- a/openedx/core/djangoapps/notifications/tests/test_views.py +++ b/openedx/core/djangoapps/notifications/tests/test_views.py @@ -370,7 +370,7 @@ def _expected_api_response(self, course=None): 'core_notification_types': [], 'notification_types': { 'ora_staff_notification': { - 'web': False, + 'web': True, 'email': False, 'push': False, 'email_cadence': 'Daily', From 579127dbdf88f502143e3998713f01d0dfda6ff0 Mon Sep 17 00:00:00 2001 From: Hassan Raza Date: Wed, 26 Mar 2025 15:00:06 +0500 Subject: [PATCH 2/3] fix: Revert default change for ora staff notifications --- openedx/core/djangoapps/notifications/base_notification.py | 2 +- openedx/core/djangoapps/notifications/tests/test_views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/notifications/base_notification.py b/openedx/core/djangoapps/notifications/base_notification.py index 5886fd383980..17ec8cda45d7 100644 --- a/openedx/core/djangoapps/notifications/base_notification.py +++ b/openedx/core/djangoapps/notifications/base_notification.py @@ -196,7 +196,7 @@ 'name': 'ora_staff_notification', 'is_core': False, 'info': '', - 'web': True, + 'web': False, 'email': False, 'push': False, 'email_cadence': EmailCadence.DAILY, diff --git a/openedx/core/djangoapps/notifications/tests/test_views.py b/openedx/core/djangoapps/notifications/tests/test_views.py index af85a5f45e2d..3d1a11e713a2 100644 --- a/openedx/core/djangoapps/notifications/tests/test_views.py +++ b/openedx/core/djangoapps/notifications/tests/test_views.py @@ -370,7 +370,7 @@ def _expected_api_response(self, course=None): 'core_notification_types': [], 'notification_types': { 'ora_staff_notification': { - 'web': True, + 'web': False, 'email': False, 'push': False, 'email_cadence': 'Daily', From 26a6df6755e3a2ffe55196e4aa4d8afeae9b4585 Mon Sep 17 00:00:00 2001 From: Hassan Raza Date: Wed, 9 Apr 2025 13:22:11 +0500 Subject: [PATCH 3/3] fix: update edx-ora2 version --- requirements/edx/base.txt | 2 +- requirements/edx/development.txt | 2 +- requirements/edx/doc.txt | 2 +- requirements/edx/testing.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index eadaf968bf87..54e239361ace 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -828,7 +828,7 @@ openedx-mongodbproxy==0.2.2 # via -r requirements/edx/kernel.in optimizely-sdk==5.2.0 # via -r requirements/edx/bundled.in -ora2==6.14.7 +ora2==6.15.0 # via -r requirements/edx/bundled.in packaging==24.2 # via diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index d87840c7b098..45b6a11f0b6e 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -1396,7 +1396,7 @@ optimizely-sdk==5.2.0 # via # -r requirements/edx/doc.txt # -r requirements/edx/testing.txt -ora2==6.14.7 +ora2==6.15.0 # via # -r requirements/edx/doc.txt # -r requirements/edx/testing.txt diff --git a/requirements/edx/doc.txt b/requirements/edx/doc.txt index aed0fd10334b..6cd5a0721dc2 100644 --- a/requirements/edx/doc.txt +++ b/requirements/edx/doc.txt @@ -1000,7 +1000,7 @@ openedx-mongodbproxy==0.2.2 # via -r requirements/edx/base.txt optimizely-sdk==5.2.0 # via -r requirements/edx/base.txt -ora2==6.14.7 +ora2==6.15.0 # via -r requirements/edx/base.txt packaging==24.2 # via diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 5e0de08429aa..467f318756bd 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -1058,7 +1058,7 @@ openedx-mongodbproxy==0.2.2 # via -r requirements/edx/base.txt optimizely-sdk==5.2.0 # via -r requirements/edx/base.txt -ora2==6.14.7 +ora2==6.15.0 # via -r requirements/edx/base.txt packaging==24.2 # via