diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4f6756fd..8a3c963d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,12 @@ Change Log Unreleased ---------- +[8.2.0] - 2023-06-08 +-------------------- +Changed +~~~~~~~ +* Added new USER_NOTIFICATION_REQUESTED event. + [8.1.0] - 2023-06-06 -------------------- Added diff --git a/openedx_events/__init__.py b/openedx_events/__init__.py index fb8e77af..a6dcc808 100644 --- a/openedx_events/__init__.py +++ b/openedx_events/__init__.py @@ -5,4 +5,4 @@ more information about the project. """ -__version__ = "8.1.0" +__version__ = "8.2.0" diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index be833a1b..cda8751e 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -235,3 +235,25 @@ class XBlockSkillVerificationData: usage_key = attr.ib(type=UsageKey) verified_skills = attr.ib(type=List[int], factory=list) ignored_skills = attr.ib(type=List[int], factory=list) + + +@attr.s(frozen=True) +class UserNotificationData: + """ + Attributes defined for Open edX User Notification data object. + + Arguments: + user_ids (List(int)): identifier of the user to which the notification belongs. + notification_type (str): type of the notification. + context (dict): additional structured information about the context in + which this topic is used, such as the section, subsection etc. + content_url (str): url of the content. + app_name (str): name of the app. + """ + + user_ids = attr.ib(type=List[int]) + notification_type = attr.ib(type=str) + content_url = attr.ib(type=str) + app_name = attr.ib(type=str) + course_key = attr.ib(type=CourseKey) + context = attr.ib(type=dict, factory=dict) diff --git a/openedx_events/learning/signals.py b/openedx_events/learning/signals.py index 63cd05c9..dffbd380 100644 --- a/openedx_events/learning/signals.py +++ b/openedx_events/learning/signals.py @@ -15,6 +15,7 @@ CourseEnrollmentData, PersistentCourseGradeData, UserData, + UserNotificationData, XBlockSkillVerificationData, ) from openedx_events.tooling import OpenEdxPublicSignal @@ -161,3 +162,16 @@ "xblock_info": XBlockSkillVerificationData, } ) + +# .. event_type: org.openedx.learning.user.notification.requested.v1 +# .. event_name: USER_NOTIFICATION +# .. event_description: Can be fired from apps to send user notifications. +# .. event_data: UserNotificationSendListData +# Warning: This event is currently incompatible with the event bus, list/dict cannot be serialized yet +# +USER_NOTIFICATION_REQUESTED = OpenEdxPublicSignal( + event_type="org.openedx.learning.user.notification.requested.v1", + data={ + "notification_data": UserNotificationData, + } +) diff --git a/openedx_events/tooling.py b/openedx_events/tooling.py index 77d6bf43..35700ed3 100644 --- a/openedx_events/tooling.py +++ b/openedx_events/tooling.py @@ -21,6 +21,7 @@ "org.openedx.learning.discussions.configuration.changed.v1", "org.openedx.content_authoring.course.certificate_config.changed.v1", "org.openedx.content_authoring.course.certificate_config.deleted.v1", + "org.openedx.learning.user.notification.requested.v1" ]