-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added edx-ace template and message type for email notifications #34315
Conversation
23eb3d9
to
4fc7b06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added some questions/suggestions!
lms/envs/common.py
Outdated
NOTIFICATIONS_EXPIRY = 60 | ||
EXPIRED_NOTIFICATIONS_DELETE_BATCH_SIZE = 10000 | ||
NOTIFICATION_CREATION_BATCH_SIZE = 99 | ||
NOTIFICATIONS_DEFAULT_FROM_EMAIL = "[email protected]" | ||
NOTIFICATION_TYPE_ICONS = {} | ||
DEFAULT_NOTIFICATION_ICON_URL = "https://edx-notifications-static.edx.org/icons/newspaper.png" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a NOTIFICATION_STATIC_ASSETS_ROOT_URL
, and extend that for this URL!
Something like NOTIFICATION_STATIC_ASSETS_ROOT_URL/icons/newspaper.png
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Will do that
return datetime_instance.strftime('%A, %b %d') | ||
|
||
|
||
def get_icon_url_for_notification_type(notification_type): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this method when we already have the get icon method in NotificationTypeIcons
class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove it. I thought of making all methods available in utils.py
.
return { | ||
"platform_name": settings.PLATFORM_NAME, | ||
"logo_url": get_logo_url_for_email(), | ||
"social_media": social_media_info, | ||
"notification_settings_url": f"{settings.ACCOUNT_MICROFRONTEND_URL}/notifications", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this all that is required? Do we have some requirements from legal to include stuff to the footer, or email body in general?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added these from the figma templates (values from bulk_email)
start_date_str = create_datetime_string(start_date) | ||
end_date_str = create_datetime_string(end_date if end_date else start_date) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these going to be UTC? What time will the user receive these digest emails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The task will run at 00:00 UTC but timezone is not needed for creating string. Format for string is Monday, Jun 12
""" | ||
Creates email context based on content | ||
start_date: datetime instance | ||
end_date: datetime instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please update DocString with some more details, including the optional params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be updated on integration.
"start_date": start_date_str, | ||
"end_date": end_date_str, | ||
"digest_frequency": digest_frequency, | ||
"updates": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this updates
. We already have a notification app with this name, might cause confusion!
Something like email_digest_updates
might be clearer!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be updated when it will be integrated to send email. There are some ambiguities where it is being used.
<table cellpadding="0" cellspacing="0" style="padding:1.875rem; background-color:#F2F0EF; color:black; font-weight:400; font-size:0.75rem;line-height:20px" width="100%"> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<table width="100%"> | ||
<tbody> | ||
<tr> | ||
<td width="20%" align="left"> | ||
<img src="{{ logo_url }}" style="width: auto;" height="24" alt="Logo"/></a> | ||
</td> | ||
<td width="80%" align="right"> | ||
<table> | ||
<tbody> | ||
<tr> | ||
{% for social_name, social_data in social_media.items %} | ||
<td> | ||
<a href="{{social_data.url}}"> | ||
<img src="{{social_data.icon}}" style="max-height: 24px; max-width: 24px" alt="{{social_name}}" /> | ||
</a> | ||
</td> | ||
{% endfor %} | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<p> | ||
You are receiving this email because you have subscribed to email digest | ||
</p> | ||
<p> | ||
<a href="{{notification_settings_url}}" rel="noopener noreferrer" target="_blank" style="color: black"> | ||
Notification Settings | ||
</a> | ||
</p> | ||
<p> | ||
© 2023 edX LLC. All Rights Reserved <br/> | ||
7900 Harkins Road, Lanham MD 20706 | ||
</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this footer compare to other ace footers in platform? Is it similar, or designed completely from scratch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This footer is designed from scratch.
@@ -0,0 +1 @@ | |||
{{ digest_frequency }} Notifications Digest for {% if digest_frequency == "Weekly" %}the Week of {% endif %}{{ start_date }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens here for Daily
Digest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For daily digest: Daily Notifications Digest for Jun 12
For weekly digest: Weekly Notifications Digest for the week of Jun 12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changes look good to me for an initial setup of the ace emails!
Please make a note of all pending items that would need to be updated on integration, so we don't miss anything later!
Thanks!
4fc7b06
to
a2c9c26
Compare
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
2U Release Notice: This PR has been deployed to the edX production environment. |
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
2U Release Notice: This PR has been deployed to the edX production environment. |
Description
Added edx-ace template and message type for email notifications.
Changes includes
Note: Some of the code will update when it will be integrated with content code
Ticket: INF-1253
How to test
Screenshot