From 40c82c2ff40fde6beaa3f83f5f2ca1617f8cbcd0 Mon Sep 17 00:00:00 2001 From: Hassan Raza Date: Wed, 9 Apr 2025 14:34:07 +0500 Subject: [PATCH] feat: Group ora staff notifications (#36440) * feat: Group ora staff notifications * fix: Revert default change for ora staff notifications * fix: update edx-ora2 version --- .../djangoapps/notifications/base_notification.py | 4 +++- .../notifications/grouping_notifications.py | 15 +++++++++++++++ requirements/edx/base.txt | 2 +- requirements/edx/development.txt | 2 +- requirements/edx/doc.txt | 2 +- requirements/edx/testing.txt | 2 +- 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/openedx/core/djangoapps/notifications/base_notification.py b/openedx/core/djangoapps/notifications/base_notification.py index ff2cc38c84..17ec8cda45 100644 --- a/openedx/core/djangoapps/notifications/base_notification.py +++ b/openedx/core/djangoapps/notifications/base_notification.py @@ -201,8 +201,10 @@ COURSE_NOTIFICATION_TYPES = { '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 0e84ea3f10..a1da88683f 100644 --- a/openedx/core/djangoapps/notifications/grouping_notifications.py +++ b/openedx/core/djangoapps/notifications/grouping_notifications.py @@ -106,6 +106,21 @@ class NewPostGrouper(BaseNotificationGrouper): } +@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/requirements/edx/base.txt b/requirements/edx/base.txt index 3663296b28..13f8da5438 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 2ceb572fbb..76d63f0cb0 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 43d2cb5aba..099fafb7bd 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 d61ffb530e..4edc93f95f 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