openedx.core.djangoapps.notifications.email package#
Submodules#
openedx.core.djangoapps.notifications.email.events module#
Events for email notifications
- openedx.core.djangoapps.notifications.email.events.send_immediate_email_digest_sent_event(user, cadence_type, notification)#
Sends tracker and segment event for immediate notification email
- openedx.core.djangoapps.notifications.email.events.send_user_email_digest_sent_event(user, cadence_type, notifications, message_context)#
Sends tracker and segment email for user email digest
openedx.core.djangoapps.notifications.email.message_type module#
Email notifications MessageType
openedx.core.djangoapps.notifications.email.notification_icons module#
Notification Icons
- class openedx.core.djangoapps.notifications.email.notification_icons.NotificationTypeIcons#
Bases:
objectNotification Mapping with icons
- CHECK_CIRCLE_GREEN = 'CHECK_CIRCLE_GREEN'#
- HELP_OUTLINE = 'HELP_OUTLINE'#
- NEWSPAPER = 'NEWSPAPER'#
- OPEN_RESPONSE_OUTLINE = 'OPEN_RESPONSE_OUTLINE'#
- POST_OUTLINE = 'POST_OUTLINE'#
- QUESTION_ANSWER_OUTLINE = 'QUESTION_ANSWER_OUTLINE'#
- REPORT_RED = 'REPORT_RED'#
- VERIFIED = 'VERIFIED'#
- classmethod get_icon_name_for_notification_type(notification_type, default='POST_OUTLINE')#
Returns icon name for notification type
- classmethod get_icon_url_for_notification_type(notification_type)#
Returns icon url for notification type
openedx.core.djangoapps.notifications.email.tasks module#
Celery tasks for sending email notifications
- openedx.core.djangoapps.notifications.email.tasks.get_audience_for_cadence_email(cadence_type)#
Returns users that are eligible to receive cadence email
- openedx.core.djangoapps.notifications.email.tasks.send_digest_email_to_user(user, cadence_type, start_date, end_date, user_language='en', courses_data=None)#
Send [cadence_type] email to user. Cadence Type can be EmailCadence.DAILY or EmailCadence.WEEKLY start_date: Datetime object end_date: Datetime object
- openedx.core.djangoapps.notifications.email.tasks.send_immediate_cadence_email(email_notification_mapping, course_key)#
Send immediate cadence email to users :param email_notification_mapping: Dictionary of user_id and Notification object :param course_key: Course key for which the email is sent
openedx.core.djangoapps.notifications.email.utils module#
Email Notifications Utils
- openedx.core.djangoapps.notifications.email.utils.add_additional_attributes_to_notifications(notifications, courses_data=None)#
Add attributes required for email content to notification instance notifications: list[Notification] course_data: Cache course info
- openedx.core.djangoapps.notifications.email.utils.add_headers_to_email_message(message, context)#
Add headers to email message
- openedx.core.djangoapps.notifications.email.utils.add_zero_margin_to_root(html_string)#
Adds to zero margin to root element of html string
- openedx.core.djangoapps.notifications.email.utils.create_app_notifications_dict(notifications)#
Return a dictionary with notification app as key and title, count and notifications as its value
- openedx.core.djangoapps.notifications.email.utils.create_datetime_string(datetime_instance)#
Returns string for datetime object
- openedx.core.djangoapps.notifications.email.utils.create_email_digest_context(app_notifications_dict, username, start_date, end_date=None, digest_frequency='Daily', courses_data=None)#
Creates email context based on content app_notifications_dict: Mapping of notification app and its count, title and notifications start_date: datetime instance end_date: datetime instance digest_frequency: EmailCadence.DAILY or EmailCadence.WEEKLY courses_data: Dictionary to cache course info (avoid additional db calls)
- openedx.core.djangoapps.notifications.email.utils.create_email_template_context(username)#
Creates email context for header and footer
- openedx.core.djangoapps.notifications.email.utils.create_missing_account_level_preferences(notifications, preferences, user)#
Creates missing account level preferences for notifications
- openedx.core.djangoapps.notifications.email.utils.decrypt_string(string)#
Decrypts input string
- openedx.core.djangoapps.notifications.email.utils.encrypt_string(string)#
Encrypts input string
- openedx.core.djangoapps.notifications.email.utils.filter_email_enabled_notifications(notifications, preferences, user, cadence_type='Daily')#
Filter notifications with email enabled in account level preferences
- openedx.core.djangoapps.notifications.email.utils.filter_notification_with_email_enabled_preferences(notifications, preferences, cadence_type='Daily')#
Filter notifications for types with email cadence preference enabled
- openedx.core.djangoapps.notifications.email.utils.get_course_info(course_key)#
Returns course info for course_key
- openedx.core.djangoapps.notifications.email.utils.get_enabled_notification_types_for_cadence(preferences, cadence_type='Daily')#
Returns a dictionary that returns notification_types with cadence_types for course_ids
- openedx.core.djangoapps.notifications.email.utils.get_icon_url_for_notification_type(notification_type)#
Returns icon url for notification type
- openedx.core.djangoapps.notifications.email.utils.get_language_preference_for_users(user_ids)#
Returns mapping of user_id and language preference for users
- openedx.core.djangoapps.notifications.email.utils.get_start_end_date(cadence_type)#
Returns start_date and end_date for email digest
- openedx.core.djangoapps.notifications.email.utils.get_text_for_notification_type(notification_type)#
Returns text for notification type
- openedx.core.djangoapps.notifications.email.utils.get_time_ago(datetime_obj)#
Returns time_ago for datetime instance
- openedx.core.djangoapps.notifications.email.utils.get_translated_app_title(name)#
Returns translated string from notification app_name key
- openedx.core.djangoapps.notifications.email.utils.get_unique_course_ids(notifications)#
Returns unique course_ids from notifications
- openedx.core.djangoapps.notifications.email.utils.get_unsubscribe_link(username)#
Returns unsubscribe url for username with patch preferences
- openedx.core.djangoapps.notifications.email.utils.is_email_notification_flag_enabled(user=None)#
Returns if waffle flag is enabled for user or not
- openedx.core.djangoapps.notifications.email.utils.is_notification_type_channel_editable(app_name, notification_type, channel)#
Returns if notification type channel is editable
- openedx.core.djangoapps.notifications.email.utils.update_user_preferences_from_patch(encrypted_username)#
Decrypt username and patch and updates user preferences Allowed parameters for decrypted patch
app_name: name of app notification_type: notification type name channel: channel name (‘web’, ‘push’, ‘email’) value: True or False course_id: course key string
- openedx.core.djangoapps.notifications.email.utils.username_from_hash(group, request)#
Django ratelimit key to return username from hash