feat: add course wide notification event for notifications having wider audience #33666
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
INF-1134
Description
Context
This PR introduces a new handler for the new
COURSE_NOTIFICATION_REQUESTED
event.The event will be fired whenever a notification is requested for a course-wide audience.
Some examples of notifications that can be requested via this event:
The event will contain 2 important components for determining the audience of the notification,
course_key
(identify the course) and theaudience_filters
(how to filter the audience within the course).Working
the
audience_filters
will be a dict containing keys that represent the type of audience to filter, and the list of values as value to specify type of filter to apply to that specific audience.The supported
audience_filters
we have right now arerole
andenrollment
.Usage of Role filter
Notification sent out to all
moderators
within the specified course.Usage of Enrollment filter
Notification sent out to all learner with enrollment mode
verified
oraudit
within the specified course.Combination of filters
We also support combination of filters i.e, we can have multiple filters at the same time. Following is an example:
This means that we will first fetch the users within course that have the enrollment mode
verified
and then fetch users with roleModerator
.The notification will be sent out to all verified learners, and moderators within the course.
❗ if the
audience_filters
is empty (no filter specified), the notification will be sent out to all active enrolled learners within the course.Followups
new_discussion_post
andnew_question_post
Related PRs
openedx/openedx-events#285