Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Template modifications
Tomasz Szymanski01b94fda16d2
diff --git a/saleor/giftcard/notifications.py b/saleor/giftcard/notifications.pyindex 7c3b99ef4b..344654ad35 100644--- a/saleor/giftcard/notifications.py+++ b/saleor/giftcard/notifications.py@@ -1,14 +1,7 @@-from ..account.models import Userfrom ..core.notifications import get_site_contextfrom ..core.notify_events import NotifyEventType-def _get_recipient_name(email):- if user := User.objects.filter(email=email).first():- return user.get_full_name()- return email--def send_gift_card_notification(user, app, email, gift_card, manager):"""Trigger sending a gift card notification for the given recipient."""payload = {@@ -19,7 +12,8 @@ def send_gift_card_notification(user, app, email, gift_card, manager):"app_name": app.name if app else None,},"recipient": {- "name": _get_recipient_name(email),+ "first_name": user.first_name if user else None,+ "last_name": user.last_name if user else None,},"recipient_email": email,"gift_card": {diff --git a/saleor/plugins/sendgrid/tests/test_tasks.py b/saleor/plugins/sendgrid/tests/test_tasks.pyindex 8ba52eb460..d65a8125c6 100644--- a/saleor/plugins/sendgrid/tests/test_tasks.py+++ b/saleor/plugins/sendgrid/tests/test_tasks.py@@ -734,7 +734,6 @@ def test_send_gift_card_email_task_by_user():template_id = "ABC1"recipient_email = "[email protected]"- recipient_name = "John Doe"payload = {"requester": {@@ -744,8 +743,8 @@ def test_send_gift_card_email_task_by_user("app_name": None,},"recipient": {- "email": recipient_email,- "name": recipient_name,+ "first_name": staff_user.first_name,+ "last_name": staff_user.last_name,},"recipient_email": recipient_email,"gift_card": {diff --git a/saleor/plugins/user_email/default_email_templates/gift_card.html b/saleor/plugins/user_email/default_email_templates/gift_card.htmlindex 10ec1e0f13..42be4f38c9 100644--- a/saleor/plugins/user_email/default_email_templates/gift_card.html+++ b/saleor/plugins/user_email/default_email_templates/gift_card.html@@ -119,7 +119,11 @@<divstyle="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:1;text-align:left;color:#000000;">- Hi, {{ recipient.name }}<br>+ {{#if recipient.first_name}}+ Hi, {{ recipient.first_name }} {{ recipient.first_name }}<br>+ {{else}}+ Hi, {{ recipient_email }}+ {{/if}}Here is your gift card!<br></div></td>