chore: modified notification digest email UI (#36809)
* chore: modified notification digest email UI * chore: added icon in settings * refactor: replaced CADENCE with DIGEST for logo variable
This commit is contained in:
committed by
GitHub
parent
aca3ba4fda
commit
a9c78cd8f7
@@ -5407,6 +5407,7 @@ NOTIFICATION_CREATION_BATCH_SIZE = 76
|
||||
NOTIFICATIONS_DEFAULT_FROM_EMAIL = "no-reply@example.com"
|
||||
NOTIFICATION_TYPE_ICONS = {}
|
||||
DEFAULT_NOTIFICATION_ICON_URL = ""
|
||||
NOTIFICATION_DIGEST_LOGO = DEFAULT_EMAIL_LOGO_URL
|
||||
|
||||
############## NUDGE EMAILS ###############
|
||||
# .. setting_name: DISABLED_ORGS_FOR_PROGRAM_NUDGE
|
||||
|
||||
@@ -11,6 +11,7 @@ class NotificationTypeIcons:
|
||||
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"
|
||||
@@ -32,7 +33,9 @@ class NotificationTypeIcons:
|
||||
"content_reported": cls.REPORT_RED,
|
||||
"response_endorsed_on_thread": cls.VERIFIED,
|
||||
"response_endorsed": cls.CHECK_CIRCLE_GREEN,
|
||||
"course_update": cls.NEWSPAPER,
|
||||
"course_updates": cls.NEWSPAPER,
|
||||
"ora_staff_notifications": cls.OPEN_RESPONSE_OUTLINE,
|
||||
"ora_grade_assigned": cls.OPEN_RESPONSE_OUTLINE,
|
||||
}
|
||||
return notification_type_dict.get(notification_type, default)
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ def create_email_template_context(username):
|
||||
"platform_name": settings.PLATFORM_NAME,
|
||||
"mailing_address": settings.CONTACT_MAILING_ADDRESS,
|
||||
"logo_url": get_logo_url_for_email(),
|
||||
"logo_notification_cadence_url": settings.NOTIFICATION_DIGEST_LOGO,
|
||||
"social_media": social_media_info,
|
||||
"notification_settings_url": f"{settings.ACCOUNT_MICROFRONTEND_URL}/#notifications",
|
||||
"unsubscribe_url": get_unsubscribe_link(username, patch)
|
||||
@@ -120,19 +121,25 @@ def create_email_digest_context(app_notifications_dict, username, start_date, en
|
||||
context = create_email_template_context(username)
|
||||
start_date_str = create_datetime_string(start_date)
|
||||
end_date_str = create_datetime_string(end_date if end_date else start_date)
|
||||
email_digest_updates = [{
|
||||
'title': 'Total Notifications',
|
||||
'translated_title': _('Total Notifications'),
|
||||
'count': sum(value['count'] for value in app_notifications_dict.values())
|
||||
}]
|
||||
email_digest_updates.extend([
|
||||
email_digest_updates = [
|
||||
{
|
||||
'title': value['title'],
|
||||
'count': value['count'],
|
||||
'translated_title': value.get('translated_title', value['title']),
|
||||
}
|
||||
for key, value in app_notifications_dict.items()
|
||||
])
|
||||
]
|
||||
lookup = {
|
||||
'Updates': 1,
|
||||
'Grading': 2,
|
||||
'Discussion': 3,
|
||||
}
|
||||
email_digest_updates.sort(key=lambda x: lookup.get(x['title'], 4), reverse=False)
|
||||
email_digest_updates.append({
|
||||
'title': 'Total Notifications',
|
||||
'translated_title': _('Total Notifications'),
|
||||
'count': sum(value['count'] for value in app_notifications_dict.values())
|
||||
})
|
||||
|
||||
email_content = []
|
||||
notifications_in_app = 5
|
||||
@@ -245,6 +252,7 @@ def add_additional_attributes_to_notifications(notifications, courses_data=None)
|
||||
notification.time_ago = get_time_ago(notification.created)
|
||||
notification.email_content = add_zero_margin_to_root(notification.content)
|
||||
notification.details = add_zero_margin_to_root(notification.content_context.get('email_content', ''))
|
||||
notification.view_text = get_text_for_notification_type(notification_type)
|
||||
return notifications
|
||||
|
||||
|
||||
@@ -447,7 +455,7 @@ def get_translated_app_title(name):
|
||||
mapping = {
|
||||
'discussion': _('Discussion'),
|
||||
'updates': _('Updates'),
|
||||
'grading': _('Grading'),
|
||||
'grading': _('Grades'),
|
||||
}
|
||||
return mapping.get(name, '')
|
||||
|
||||
@@ -468,7 +476,7 @@ def get_text_for_notification_type(notification_type):
|
||||
if not app_name:
|
||||
return ""
|
||||
mapping = {
|
||||
'discussion': _('post'),
|
||||
'discussion': _('discussion'),
|
||||
'updates': _('update'),
|
||||
'grading': _('assessment'),
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</span>
|
||||
<span style="float: right">
|
||||
<a href="{{notification.content_url}}" style="text-decoration: none; color: #00688D">
|
||||
{% trans "View" as tmsg %}{{ tmsg | force_escape }}
|
||||
{% trans "View" as tmsg %}{{ tmsg | force_escape }} {{ notification.view_text|default:""}}
|
||||
</a>
|
||||
</span>
|
||||
</blockquote>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="25%" align="left" style="padding: 0">
|
||||
<img src="{{ logo_url }}" style="width: auto;" height="24" alt="Logo"/></a>
|
||||
<img src="{{ logo_url }}" style="width: auto;" height="32" alt="Logo"/></a>
|
||||
</td>
|
||||
<td width="75%" align="right" style="padding: 0">
|
||||
<table>
|
||||
|
||||
@@ -15,16 +15,16 @@
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<td>
|
||||
<img src="{{ logo_url }}" style="width: 64px" height="auto" alt="logo_url" />
|
||||
<img src="{{ logo_notification_cadence_url }}" style="width: 64px" height="auto" alt="logo_url" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="height: 20px"></tr>
|
||||
<tr align="center">
|
||||
<td style="font-family: Inter, Arial, Verdana, sans-serif; font-size: 32px; font-style: normal; font-weight: 700; line-height: 36px">
|
||||
{% if digest_frequency == "Weekly" %}
|
||||
{% trans "Weekly email digest" as tmsg %}{{ tmsg | force_escape }}
|
||||
{% trans "Weekly Notifications Digest" as tmsg %}{{ tmsg | force_escape }}
|
||||
{% else %}
|
||||
{% trans "Daily email digest" as tmsg %}{{ tmsg | force_escape }}
|
||||
{% trans "Daily Notifications Digest" as tmsg %}{{ tmsg | force_escape }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user