Skip to content

Commit

Permalink
feat: Add CONTENT_OBJECT_TAGS_CHANGED signal (#327)
Browse files Browse the repository at this point in the history
This signal is emitted when tags on a content object have changed.
  • Loading branch information
yusuf-musleh authored Apr 1, 2024
1 parent 215ddc0 commit 197690d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Change Log
Unreleased
----------
Added
~~~~~
* Added new ``CONTENT_OBJECT_TAGGED`` events in content_authoring.

[9.5.2] - 2024-02-13
--------------------
Expand Down
2 changes: 1 addition & 1 deletion openedx_events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
more information about the project.
"""

__version__ = "9.5.2"
__version__ = "9.6.0"
14 changes: 14 additions & 0 deletions openedx_events/content_authoring/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,17 @@ class LibraryBlockData:

library_key = attr.ib(type=LibraryLocatorV2)
usage_key = attr.ib(type=LibraryUsageLocatorV2)


@attr.s(frozen=True)
class ContentObjectData:
"""
Data about changed content object
Arguments:
object_id (str): identifier of the Content object. This represents the id of the course or library block
as a string. For example:
block-v1:SampleTaxonomyOrg2+STC1+2023_1+type@vertical+block@f8de78f0897049ce997777a3a31b6ea0
"""

object_id = attr.ib(type=str)
12 changes: 12 additions & 0 deletions openedx_events/content_authoring/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from openedx_events.content_authoring.data import (
CertificateConfigData,
ContentLibraryData,
ContentObjectData,
CourseCatalogData,
CourseData,
DuplicatedXBlockData,
Expand Down Expand Up @@ -198,3 +199,14 @@
"library_block": LibraryBlockData,
}
)

# .. event_type: org.openedx.content_authoring.content.object.tags.changed.v1
# .. event_name: CONTENT_OBJECT_TAGS_CHANGED
# .. event_description: emitted when an object's tags are changed
# .. event_data: ContentObjectData
CONTENT_OBJECT_TAGS_CHANGED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content.object.tags.changed.v1",
data={
"content_object": ContentObjectData
}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "content_object",
"type": {
"name": "ContentObjectData",
"type": "record",
"fields": [
{
"name": "object_id",
"type": "string"
}
]
}
}
],
"namespace": "org.openedx.content_authoring.content.object.tags.changed.v1"
}

0 comments on commit 197690d

Please # to comment.