Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Email context improvements

Tomasz Szymanskia5f8cc1d062a
diff --git a/saleor/giftcard/notifications.py b/saleor/giftcard/notifications.py
index b607b25947..7c3b99ef4b 100644
--- a/saleor/giftcard/notifications.py
+++ b/saleor/giftcard/notifications.py
@@ -13,13 +13,15 @@ def send_gift_card_notification(user, app, email, gift_card, manager):
"""Trigger sending a gift card notification for the given recipient."""
payload = {
"requester": {
+ "user_id": user.id if user else None,
"email": user.email if user else None,
+ "app_id": app.id if app else None,
"app_name": app.name if app else None,
},
"recipient": {
- "email": email,
"name": _get_recipient_name(email),
},
+ "recipient_email": email,
"gift_card": {
"id": gift_card.id,
"code": gift_card.code,
diff --git a/saleor/plugins/sendgrid/tests/test_tasks.py b/saleor/plugins/sendgrid/tests/test_tasks.py
index 0c618600d4..8ba52eb460 100644
--- a/saleor/plugins/sendgrid/tests/test_tasks.py
+++ b/saleor/plugins/sendgrid/tests/test_tasks.py
@@ -738,13 +738,16 @@ def test_send_gift_card_email_task_by_user(
payload = {
"requester": {
+ "user_id": staff_user.id,
"email": staff_user.email,
+ "app_id": None,
"app_name": None,
},
"recipient": {
"email": recipient_email,
"name": recipient_name,
},
+ "recipient_email": recipient_email,
"gift_card": {
"id": gift_card.id,
"code": gift_card.code,
diff --git a/saleor/plugins/user_email/default_email_templates/gift_card.html b/saleor/plugins/user_email/default_email_templates/gift_card.html
index c3af159eb9..10ec1e0f13 100644
--- a/saleor/plugins/user_email/default_email_templates/gift_card.html
+++ b/saleor/plugins/user_email/default_email_templates/gift_card.html
@@ -119,8 +119,8 @@
<div
style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">
- Hi, {{ recipient.name }}
- Here is your gift card!</div>
+ Hi, {{ recipient.name }}<br>
+ Here is your gift card!<br></div>
</td>
</tr>
@@ -130,8 +130,8 @@
<div
style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">
- {{ gift_card.currency }} {{ gift_card.balance }}
- Gift card code: {{ gift_card.code }}</div>
+ {{ gift_card.currency }} {{ gift_card.balance }}<br>
+ Gift card code: {{ gift_card.code }}<br></div>
</td>
</tr>
@@ -141,8 +141,8 @@
<div
style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">
- Use this card as payment for anything you like in {{ site_name }}.
- Enter the gift card code at checkout to redeem your gift card.</div>
+ Use this card as payment for anything you like in {{ site_name }}.<br>
+ Enter the gift card code at checkout to redeem your gift card.<br></div>
</td>
</tr>