Skip to content

Commit

Permalink
feat: create event for discussion events
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Sep 28, 2023
1 parent 78e3ba5 commit 9482fa2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
28 changes: 28 additions & 0 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,31 @@ class ProgramCertificateData:
status = attr.ib(type=str)
url = attr.ib(type=str)
certificate_available_date = attr.ib(type=datetime, default=None)


@attr.s(frozen=True)
class DiscussionThreadData:
"""
Attributes defined for Open edX Discussion Thread data object.
Arguments:
"""

anonymous = attr.ib(type=bool)
anonymous_to_peers = attr.ib(type=bool)
body = attr.ib(type=str)
category_id = attr.ib(type=int)
category_name = attr.ib(type=str)
commentable_id = attr.ib(type=str)
group_id = attr.ib(type=int)
id = attr.ib(type=int)
options = attr.ib(type=dict)
team_id = attr.ib(type=int)
thread_type = attr.ib(type=str)
title = attr.ib(type=str)
title_truncated = attr.ib(type=bool)
truncated = attr.ib(type=bool)
url = attr.ib(type=str)
user_course_roles = attr.ib(type=List[str])
user_forums_roles = attr.ib(type=List[str])
13 changes: 13 additions & 0 deletions openedx_events/learning/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
CohortData,
CourseDiscussionConfigurationData,
CourseEnrollmentData,
DiscussionThreadData,
PersistentCourseGradeData,
ProgramCertificateData,
UserData,
Expand Down Expand Up @@ -196,3 +197,15 @@
"notification_data": UserNotificationData,
}
)

# .. event_type: org.openedx.learning.thread.created.v1
# .. event_name: THREAD_CREATED
# .. event_description: Emitted when a new thread is created in a discussion
# .. event_data: DiscussionThreadData
#
THREAD_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.learning.thread.created.v1",
data={
"thread": DiscussionThreadData,
}
)

0 comments on commit 9482fa2

Please sign in to comment.