From a9e78daeb96b9a7fcf4a0799e606bda886e4c931 Mon Sep 17 00:00:00 2001 From: Cristhian Garcia Date: Thu, 28 Sep 2023 17:19:16 -0500 Subject: [PATCH] feat: create event for response and comment events --- CHANGELOG.rst | 6 ++++++ openedx_events/__init__.py | 2 +- openedx_events/learning/data.py | 3 +++ openedx_events/learning/signals.py | 24 ++++++++++++++++++++++++ openedx_events/tooling.py | 2 ++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b833062d3..cc3f31025 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,12 @@ Changed ~~~~~~~ * Re-licensed this repository from AGPL 3.0 to Apache 2.0 +[8.7.0] - 2023-09-29 +-------------------- +Added +~~~~~ +* Added new ``FORUM_THREAD_CREATED``, ``FORUM_RESPONSE_CREATED``, ``FORUM_COMMENT_CREATED`` events in learning subdomain + [8.6.0] - 2023-08-28 -------------------- Added diff --git a/openedx_events/__init__.py b/openedx_events/__init__.py index 3feb7fdf3..e2ea442e0 100644 --- a/openedx_events/__init__.py +++ b/openedx_events/__init__.py @@ -5,4 +5,4 @@ more information about the project. """ -__version__ = "8.6.0" +__version__ = "8.7.0" diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index 13b89b7ef..09a43cb3f 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -334,6 +334,9 @@ class DiscussionThreadData: title_truncated = attr.ib(type=bool) truncated = attr.ib(type=bool) url = attr.ib(type=str) + user_id = attr.ib(type=int) + course_id = attr.ib(type=CourseKey) + discussion = attr.ib(type=dict, factory=dict) user_course_roles = attr.ib(type=List[str], factory=list) user_forums_roles = attr.ib(type=List[str], factory=list) options = attr.ib(type=dict, factory=dict) diff --git a/openedx_events/learning/signals.py b/openedx_events/learning/signals.py index 7827f434e..c51cb22d0 100644 --- a/openedx_events/learning/signals.py +++ b/openedx_events/learning/signals.py @@ -209,3 +209,27 @@ "thread": DiscussionThreadData, } ) + +# .. event_type: org.openedx.learning.thread.created.v1 +# .. event_name: FORUM_RESPONSE_CREATED +# .. event_description: Emitted when a new response is added to a thread +# .. event_data: DiscussionThreadData +# Warning: This event is currently incompatible with the event bus, list/dict cannot be serialized yet +FORUM_RESPONSE_CREATED = OpenEdxPublicSignal( + event_type="org.openedx.learning.response.created.v1", + data={ + "thread": DiscussionThreadData, + } +) + +# .. event_type: org.openedx.learning.thread.created.v1 +# .. event_name: FORUM_RESPONSE_CREATED +# .. event_description: Emitted when a new comment is added to a thread +# .. event_data: DiscussionThreadData +# Warning: This event is currently incompatible with the event bus, list/dict cannot be serialized yet +FORUM_COMMENT_CREATED = OpenEdxPublicSignal( + event_type="org.openedx.learning.response.created.v1", + data={ + "thread": DiscussionThreadData, + } +) diff --git a/openedx_events/tooling.py b/openedx_events/tooling.py index e4ff108bb..1547428a2 100644 --- a/openedx_events/tooling.py +++ b/openedx_events/tooling.py @@ -23,6 +23,8 @@ "org.openedx.content_authoring.course.certificate_config.deleted.v1", "org.openedx.learning.user.notification.requested.v1", "org.openedx.learning.thread.created.v1", + "org.openedx.learning.response.created.v1", + "org.openedx.learning.comment.created.v1", ]