Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cms/djangoapps/contentstore/signals/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ def emit_catalog_info_changed_signal(course_key: CourseKey):
if SEND_CATALOG_INFO_SIGNAL.is_enabled():
timestamp, catalog_info = _create_catalog_data_for_signal(course_key)
if catalog_info is not None:
# .. event_implemented_name: COURSE_CATALOG_INFO_CHANGED
# .. event_type: org.openedx.content_authoring.course.catalog_info.changed.v1
COURSE_CATALOG_INFO_CHANGED.send_event(time=timestamp, catalog_info=catalog_info)


Expand Down
2 changes: 2 additions & 0 deletions cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2314,6 +2314,8 @@ def send_course_update_notification(course_key, content, user):
app_name="updates",
audience_filters={},
)
# .. event_implemented_name: COURSE_NOTIFICATION_REQUESTED
# .. event_type: org.openedx.learning.course.notification.requested.v1
COURSE_NOTIFICATION_REQUESTED.send_event(course_notification_data=notification_data)


Expand Down
4 changes: 4 additions & 0 deletions common/djangoapps/student/signals/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def emit_course_access_role_added(user, course_id, org_key, role):
"""
Emit an event to the event-bus when a CourseAccessRole is added
"""
# .. event_implemented_name: COURSE_ACCESS_ROLE_ADDED
# .. event_type: org.openedx.learning.user.course_access_role.added.v1
COURSE_ACCESS_ROLE_ADDED.send_event(
course_access_role_data=CourseAccessRoleData(
user=UserData(
Expand All @@ -52,6 +54,8 @@ def emit_course_access_role_removed(user, course_id, org_key, role):
"""
Emit an event to the event-bus when a CourseAccessRole is deleted
"""
# .. event_implemented_name: COURSE_ACCESS_ROLE_REMOVED
# .. event_type: org.openedx.learning.user.course_access_role.removed.v1
COURSE_ACCESS_ROLE_REMOVED.send_event(
course_access_role_data=CourseAccessRoleData(
user=UserData(
Expand Down
8 changes: 8 additions & 0 deletions lms/djangoapps/discussion/django_comment_client/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ def track_forum_event(request, event_name, course, obj, data, id_map=None):

forum_event = TRACKING_LOG_TO_EVENT_MAPS.get(event_name, None)
if forum_event is not None:
# .. event_implemented_name: FORUM_THREAD_CREATED
# .. event_type: org.openedx.learning.forum.thread.created.v1

# .. event_implemented_name: FORUM_THREAD_RESPONSE_CREATED
# .. event_type: org.openedx.learning.forum.thread.response.created.v1

# .. event_implemented_name: FORUM_RESPONSE_COMMENT_CREATED
# .. event_type: org.openedx.learning.forum.thread.response.comment.created.v1
forum_event.send_event(
thread=DiscussionThreadData(
anonymous=data.get('anonymous'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def _send_notification(self, user_ids, notification_type, extra_context=None):
app_name="discussion",
course_key=self.course.id,
)
# .. event_implemented_name: USER_NOTIFICATION_REQUESTED
# .. event_type: org.openedx.learning.user.notification.requested.v1
USER_NOTIFICATION_REQUESTED.send_event(notification_data=notification_data)

def _send_course_wide_notification(self, notification_type, audience_filters=None, extra_context=None):
Expand All @@ -97,6 +99,8 @@ def _send_course_wide_notification(self, notification_type, audience_filters=Non
app_name="discussion",
audience_filters=audience_filters,
)
# .. event_implemented_name: COURSE_NOTIFICATION_REQUESTED
# .. event_type: org.openedx.learning.course.notification.requested.v1
COURSE_NOTIFICATION_REQUESTED.send_event(course_notification_data=notification_data)

def _get_parent_response(self):
Expand Down
4 changes: 4 additions & 0 deletions lms/djangoapps/grades/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ def _emit_course_passing_status_update(user, course_id, is_passing):
The status of event is determined by is_passing parameter.
"""
if hasattr(course_id, 'ccx'):
# .. event_implemented_name: CCX_COURSE_PASSING_STATUS_UPDATED
# .. event_type: org.openedx.learning.ccx.course.passing.status.updated.v1
CCX_COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CcxCoursePassingStatusData(
is_passing=is_passing,
Expand All @@ -298,6 +300,8 @@ def _emit_course_passing_status_update(user, course_id, is_passing):
)
)
else:
# .. event_implemented_name: COURSE_PASSING_STATUS_UPDATED
# .. event_type: org.openedx.learning.course.passing.status.updated.v1
COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CoursePassingStatusData(
is_passing=is_passing,
Expand Down
29 changes: 28 additions & 1 deletion openedx/core/djangoapps/content_libraries/api/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ def set_library_block_olx(usage_key: LibraryUsageLocatorV2, new_olx_str: str) ->
created=now,
)

# .. event_implemented_name: LIBRARY_BLOCK_UPDATED
# .. event_type: org.openedx.content_authoring.library_block.updated.v1
LIBRARY_BLOCK_UPDATED.send_event(
library_block=LibraryBlockData(
library_key=usage_key.context_key,
Expand All @@ -231,6 +233,8 @@ def set_library_block_olx(usage_key: LibraryUsageLocatorV2, new_olx_str: str) ->
# container indexing asynchronously.
affected_containers = get_containers_contains_item(usage_key)
for container in affected_containers:
# .. event_implemented_name: LIBRARY_CONTAINER_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1
LIBRARY_CONTAINER_UPDATED.send_event(
library_container=LibraryContainerData(
container_key=container.container_key,
Expand Down Expand Up @@ -309,6 +313,9 @@ def create_library_block(
_create_component_for_block(content_library, usage_key, user_id, can_stand_alone)

# Now return the metadata about the new block:

# .. event_implemented_name: LIBRARY_BLOCK_CREATED
# .. event_type: org.openedx.content_authoring.library_block.created.v1
LIBRARY_BLOCK_CREATED.send_event(
library_block=LibraryBlockData(
library_key=content_library.library_key,
Expand Down Expand Up @@ -449,6 +456,8 @@ def _import_staged_block(
)

# Emit library block created event
# .. event_implemented_name: LIBRARY_BLOCK_CREATED
# .. event_type: org.openedx.content_authoring.library_block.created.v1
LIBRARY_BLOCK_CREATED.send_event(
library_block=LibraryBlockData(
library_key=content_library.library_key,
Expand Down Expand Up @@ -589,6 +598,8 @@ def delete_library_block(

authoring_api.soft_delete_draft(component.pk, deleted_by=user_id)

# .. event_implemented_name: LIBRARY_BLOCK_DELETED
# .. event_type: org.openedx.content_authoring.library_block.deleted.v1
LIBRARY_BLOCK_DELETED.send_event(
library_block=LibraryBlockData(
library_key=library_key,
Expand All @@ -601,6 +612,8 @@ def delete_library_block(
#
# To delete the component on collections
for collection in affected_collections:
# .. event_implemented_name: LIBRARY_COLLECTION_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.collection.updated.v1
LIBRARY_COLLECTION_UPDATED.send_event(
library_collection=LibraryCollectionData(
collection_key=library_collection_locator(
Expand All @@ -616,6 +629,8 @@ def delete_library_block(
#
# To update the components count in containers
for container in affected_containers:
# .. event_implemented_name: LIBRARY_CONTAINER_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1
LIBRARY_CONTAINER_UPDATED.send_event(
library_container=LibraryContainerData(
container_key=container.container_key,
Expand All @@ -639,14 +654,18 @@ def restore_library_block(usage_key: LibraryUsageLocatorV2, user_id: int | None
set_by=user_id,
)

# .. event_implemented_name: LIBRARY_BLOCK_CREATED
# .. event_type: org.openedx.content_authoring.library_block.created.v1
LIBRARY_BLOCK_CREATED.send_event(
library_block=LibraryBlockData(
library_key=library_key,
usage_key=usage_key
)
)

# Add tags, collections and units back to index
# Add tags and collections back to index
# .. event_implemented_name: CONTENT_OBJECT_ASSOCIATIONS_CHANGED
# .. event_type: org.openedx.content_authoring.content.object.associations.changed.v1
CONTENT_OBJECT_ASSOCIATIONS_CHANGED.send_event(
content_object=ContentObjectChangedData(
object_id=str(usage_key),
Expand All @@ -659,6 +678,8 @@ def restore_library_block(usage_key: LibraryUsageLocatorV2, user_id: int | None
#
# To restore the component in the collections
for collection in affected_collections:
# .. event_implemented_name: LIBRARY_COLLECTION_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.collection.updated.v1
LIBRARY_COLLECTION_UPDATED.send_event(
library_collection=LibraryCollectionData(
collection_key=library_collection_locator(
Expand All @@ -675,6 +696,8 @@ def restore_library_block(usage_key: LibraryUsageLocatorV2, user_id: int | None
# To update the components count in containers
affected_containers = get_containers_contains_item(usage_key)
for container in affected_containers:
# .. event_implemented_name: LIBRARY_CONTAINER_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1
LIBRARY_CONTAINER_UPDATED.send_event(
library_container=LibraryContainerData(
container_key=container.container_key,
Expand Down Expand Up @@ -768,6 +791,8 @@ def add_library_block_static_asset_file(
created_by=user.id if user else None,
)
transaction.on_commit(
# .. event_implemented_name: LIBRARY_BLOCK_UPDATED
# .. event_type: org.openedx.content_authoring.library_block.updated.v1
lambda: LIBRARY_BLOCK_UPDATED.send_event(
library_block=LibraryBlockData(
library_key=usage_key.context_key,
Expand Down Expand Up @@ -814,6 +839,8 @@ def delete_library_block_static_asset_file(usage_key, file_path, user=None):
created_by=user.id if user else None,
)
transaction.on_commit(
# .. event_implemented_name: LIBRARY_BLOCK_UPDATED
# .. event_type: org.openedx.content_authoring.library_block.updated.v1
lambda: LIBRARY_BLOCK_UPDATED.send_event(
library_block=LibraryBlockData(
library_key=usage_key.context_key,
Expand Down
2 changes: 2 additions & 0 deletions openedx/core/djangoapps/content_libraries/api/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def set_library_item_collections(
# For each collection, trigger LIBRARY_COLLECTION_UPDATED signal and set background=True to trigger
# collection indexing asynchronously.
for collection in affected_collections:
# .. event_implemented_name: LIBRARY_COLLECTION_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.collection.updated.v1
LIBRARY_COLLECTION_UPDATED.send_event(
library_collection=LibraryCollectionData(
collection_key=library_collection_locator(
Expand Down
34 changes: 34 additions & 0 deletions openedx/core/djangoapps/content_libraries/api/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def create_container(
case _:
raise NotImplementedError(f"Library does not support {container_type} yet")

# .. event_implemented_name: LIBRARY_CONTAINER_CREATED
# .. event_type: org.openedx.content_authoring.content_library.container.created.v1
LIBRARY_CONTAINER_CREATED.send_event(
library_container=LibraryContainerData(
container_key=container_key,
Expand Down Expand Up @@ -348,6 +350,8 @@ def update_container(
raise NotImplementedError(f"Library does not support {container_type} yet")

# Send event related to the updated container
# .. event_implemented_name: LIBRARY_CONTAINER_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1
LIBRARY_CONTAINER_UPDATED.send_event(
library_container=LibraryContainerData(
container_key=container_key,
Expand All @@ -357,6 +361,8 @@ def update_container(
# Send events related to the containers that contains the updated container.
# This is to update the children display names used in the section/subsection previews.
for affected_container in affected_containers:
# .. event_implemented_name: LIBRARY_CONTAINER_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1
LIBRARY_CONTAINER_UPDATED.send_event(
library_container=LibraryContainerData(
container_key=affected_container.container_key,
Expand All @@ -366,6 +372,8 @@ def update_container(
# All subsections under a section have section key in index that needs to be updated.
# So if parent section name has been changed, it needs to be reflected in sections key of children
for child in children:
# .. event_implemented_name: CONTENT_OBJECT_ASSOCIATIONS_CHANGED
# .. event_type: org.openedx.content_authoring.content.object.associations.changed.v1
CONTENT_OBJECT_ASSOCIATIONS_CHANGED.send_event(
content_object=ContentObjectChangedData(
object_id=str(getattr(child, child_key_name)),
Expand Down Expand Up @@ -400,6 +408,8 @@ def delete_container(
)
authoring_api.soft_delete_draft(container.pk)

# .. event_implemented_name: LIBRARY_CONTAINER_DELETED
# .. event_type: org.openedx.content_authoring.content_library.container.deleted.v1
LIBRARY_CONTAINER_DELETED.send_event(
library_container=LibraryContainerData(
container_key=container_key,
Expand All @@ -411,6 +421,8 @@ def delete_container(
#
# To delete the container on collections
for collection in affected_collections:
# .. event_implemented_name: LIBRARY_COLLECTION_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.collection.updated.v1
LIBRARY_COLLECTION_UPDATED.send_event(
library_collection=LibraryCollectionData(
collection_key=library_collection_locator(
Expand All @@ -423,6 +435,8 @@ def delete_container(
# Send events related to the containers that contains the updated container.
# This is to update the children display names used in the section/subsection previews.
for affected_container in affected_containers:
# .. event_implemented_name: LIBRARY_CONTAINER_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1
LIBRARY_CONTAINER_UPDATED.send_event(
library_container=LibraryContainerData(
container_key=affected_container.container_key,
Expand All @@ -437,6 +451,8 @@ def delete_container(
# All subsections under a section have section key in index that needs to be updated.
# So if parent section is deleted, it needs to be removed from sections key of children
for child in children:
# .. event_implemented_name: CONTENT_OBJECT_ASSOCIATIONS_CHANGED
# .. event_type: org.openedx.content_authoring.content.object.associations.changed.v1
CONTENT_OBJECT_ASSOCIATIONS_CHANGED.send_event(
content_object=ContentObjectChangedData(
object_id=str(getattr(child, key_name)),
Expand Down Expand Up @@ -466,6 +482,8 @@ def restore_container(container_key: LibraryContainerLocator) -> None:
published=False,
)

# .. event_implemented_name: LIBRARY_CONTAINER_CREATED
# .. event_type: org.openedx.content_authoring.content_library.container.created.v1
LIBRARY_CONTAINER_CREATED.send_event(
library_container=LibraryContainerData(
container_key=container_key,
Expand All @@ -477,6 +495,8 @@ def restore_container(container_key: LibraryContainerLocator) -> None:
# Update parent key data in index. Eg. `sections` key in index for subsection
content_changes.append(str(affected_containers[0].container_type.value) + "s")
# Add tags, collections and parent data back to index
# .. event_implemented_name: CONTENT_OBJECT_ASSOCIATIONS_CHANGED
# .. event_type: org.openedx.content_authoring.content.object.associations.changed.v1
CONTENT_OBJECT_ASSOCIATIONS_CHANGED.send_event(
content_object=ContentObjectChangedData(
object_id=str(container_key),
Expand All @@ -489,6 +509,8 @@ def restore_container(container_key: LibraryContainerLocator) -> None:
#
# To restore the container on collections
for collection in affected_collections:
# .. event_implemented_name: LIBRARY_COLLECTION_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.collection.updated.v1
LIBRARY_COLLECTION_UPDATED.send_event(
library_collection=LibraryCollectionData(
collection_key=library_collection_locator(
Expand All @@ -500,6 +522,8 @@ def restore_container(container_key: LibraryContainerLocator) -> None:
# Send events related to the containers that contains the updated container.
# This is to update the children display names used in the section/subsection previews.
for affected_container in affected_containers:
# .. event_implemented_name: LIBRARY_CONTAINER_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1
LIBRARY_CONTAINER_UPDATED.send_event(
library_container=LibraryContainerData(
container_key=affected_container.container_key,
Expand All @@ -513,6 +537,8 @@ def restore_container(container_key: LibraryContainerLocator) -> None:
# All subsections under a section have section key in index that needs to be updated.
# Should restore removed parent section in sections key of children subsections
for child in children:
# .. event_implemented_name: CONTENT_OBJECT_ASSOCIATIONS_CHANGED
# .. event_type: org.openedx.content_authoring.content.object.associations.changed.v1
CONTENT_OBJECT_ASSOCIATIONS_CHANGED.send_event(
content_object=ContentObjectChangedData(
object_id=str(getattr(child, key_name)),
Expand Down Expand Up @@ -597,6 +623,8 @@ def update_container_children(
)

for key in children_ids:
# .. event_implemented_name: CONTENT_OBJECT_ASSOCIATIONS_CHANGED
# .. event_type: org.openedx.content_authoring.content.object.associations.changed.v1
CONTENT_OBJECT_ASSOCIATIONS_CHANGED.send_event(
content_object=ContentObjectChangedData(
object_id=str(key),
Expand All @@ -614,6 +642,8 @@ def update_container_children(
)

for key in children_ids:
# .. event_implemented_name: CONTENT_OBJECT_ASSOCIATIONS_CHANGED
# .. event_type: org.openedx.content_authoring.content.object.associations.changed.v1
CONTENT_OBJECT_ASSOCIATIONS_CHANGED.send_event(
content_object=ContentObjectChangedData(
object_id=str(key),
Expand All @@ -631,6 +661,8 @@ def update_container_children(
)

for key in children_ids:
# .. event_implemented_name: CONTENT_OBJECT_ASSOCIATIONS_CHANGED
# .. event_type: org.openedx.content_authoring.content.object.associations.changed.v1
CONTENT_OBJECT_ASSOCIATIONS_CHANGED.send_event(
content_object=ContentObjectChangedData(
object_id=str(key),
Expand All @@ -640,6 +672,8 @@ def update_container_children(
case _:
raise ValueError(f"Invalid container type: {container_type}")

# .. event_implemented_name: LIBRARY_CONTAINER_UPDATED
# .. event_type: org.openedx.content_authoring.content_library.container.updated.v1
LIBRARY_CONTAINER_UPDATED.send_event(
library_container=LibraryContainerData(
container_key=container_key,
Expand Down
Loading
Loading