Skip to content

Commit

Permalink
feat: create event for response and comment events
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Sep 29, 2023
1 parent 434a194 commit 2109b79
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ class DiscussionThreadData:
title_truncated = attr.ib(type=bool)
truncated = attr.ib(type=bool)
url = attr.ib(type=str)
user_id = attr.ib(type=int)
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)
24 changes: 24 additions & 0 deletions openedx_events/learning/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
)
2 changes: 2 additions & 0 deletions openedx_events/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]


Expand Down

0 comments on commit 2109b79

Please sign in to comment.