Skip to content

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

Simplify templated e-mails folder structure

Anna Siwik6f268e61c1c3
diff --git a/.gitignore b/.gitignore
index 8739720352..628711b011 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,4 +28,4 @@ dist/
/static/
/saleor/static/assets/
webpack-bundle.json
-/templates/templated_email/html/compiled/
+/templates/templated_email/compiled/
diff --git a/package.json b/package.json
index a971bbab41..46f500a3d3 100644
--- a/package.json
+++ b/package.json
@@ -90,6 +90,6 @@
"build-assets": "node ./node_modules/webpack/bin/webpack.js -p --progress",
"heroku-postbuild": "npm run build-assets",
"start": "UV_THREADPOOL_SIZE=8 node ./node_modules/webpack/bin/webpack.js -d --watch --progress",
- "build-emails": "mkdir -p templates/templated_email/html/compiled/ && find templates -name \"*.mjml\" -not -path \"templates/templated_email/html/source/*partials/*\" -not -path \"templates/templated_email/html/source/*shared/*\" -exec ./node_modules/.bin/mjml -l skip {} -o templates/templated_email/html/compiled/ \\;"
+ "build-emails": "mkdir -p templates/templated_email/compiled/ && find templates -name \"*.mjml\" -not -path \"templates/templated_email/source/*partials/*\" -not -path \"templates/templated_email/source/*shared/*\" -exec ./node_modules/.bin/mjml -l skip {} -o templates/templated_email/compiled/ \\;"
}
}
diff --git a/saleor/dashboard/emails.py b/saleor/dashboard/emails.py
index 266c7f6a72..173ac37fde 100644
--- a/saleor/dashboard/emails.py
+++ b/saleor/dashboard/emails.py
@@ -20,7 +20,7 @@ def send_set_password_email(staff):
'uid': urlsafe_base64_encode(force_bytes(staff.pk)).decode(),
'token': default_token_generator.make_token(staff)}
send_templated_mail(
- template_name='dashboard/staff/set_password',
+ template_name='source/dashboard/staff/set_password',
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=[staff.email],
context=ctx)
@@ -35,7 +35,7 @@ def send_promote_customer_to_staff_email(staff):
'url': build_absolute_uri(reverse('dashboard:index')),
'site_name': site.name}
send_templated_mail(
- template_name='dashboard/staff/promote_customer',
+ template_name='source/dashboard/staff/promote_customer',
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=[staff.email],
context=ctx)
diff --git a/saleor/order/emails.py b/saleor/order/emails.py
index dd5404a52c..bf0e6e585e 100644
--- a/saleor/order/emails.py
+++ b/saleor/order/emails.py
@@ -3,9 +3,9 @@ from django.conf import settings
from django.contrib.sites.models import Site
from templated_email import send_templated_mail
-CONFIRM_ORDER_TEMPLATE = 'order/confirm_order'
-CONFIRM_PAYMENT_TEMPLATE = 'order/payment/confirm_payment'
-CONFIRM_NOTE_TEMPLATE = 'order/note/confirm_note'
+CONFIRM_ORDER_TEMPLATE = 'source/order/confirm_order'
+CONFIRM_PAYMENT_TEMPLATE = 'source/order/payment/confirm_payment'
+CONFIRM_NOTE_TEMPLATE = 'source/order/note/confirm_note'
def _send_confirmation(email, url, template, context=None):
diff --git a/saleor/registration/emails.py b/saleor/registration/emails.py
index 2be030ca45..c3004617af 100644
--- a/saleor/registration/emails.py
+++ b/saleor/registration/emails.py
@@ -14,7 +14,7 @@ def send_password_reset_email(context, recipient):
kwargs={'uidb64': context['uid'], 'token': context['token']}))
context['reset_url'] = reset_url
send_templated_mail(
- template_name='account/password_reset',
+ template_name='source/account/password_reset',
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=[recipient],
context=context)
diff --git a/templates/templated_email/account/password_reset.email b/templates/templated_email/source/account/password_reset.email
similarity index 92%
rename from templates/templated_email/account/password_reset.email
rename to templates/templated_email/source/account/password_reset.email
index 719e4e284c..46964ee422 100644
--- a/templates/templated_email/account/password_reset.email
+++ b/templates/templated_email/source/account/password_reset.email
@@ -23,5 +23,5 @@ Sincerely,
{% endblock %}
{% block html %}
-{% include 'templated_email/html/compiled/password_reset.html' %}
+{% include 'templated_email/compiled/password_reset.html' %}
{% endblock %}
diff --git a/templates/templated_email/html/source/account/password_reset.mjml b/templates/templated_email/source/account/password_reset.mjml
similarity index 100%
rename from templates/templated_email/html/source/account/password_reset.mjml
rename to templates/templated_email/source/account/password_reset.mjml
diff --git a/templates/templated_email/dashboard/staff/promote_customer.email b/templates/templated_email/source/dashboard/staff/promote_customer.email
similarity index 88%
rename from templates/templated_email/dashboard/staff/promote_customer.email
rename to templates/templated_email/source/dashboard/staff/promote_customer.email
index 8ae8594af7..198cedc9b1 100644
--- a/templates/templated_email/dashboard/staff/promote_customer.email
+++ b/templates/templated_email/source/dashboard/staff/promote_customer.email
@@ -13,5 +13,5 @@ This is an automatically generated email, please do not reply.
{% endblock %}
{% block html %}
-{% include 'templated_email/html/compiled/promote_customer.html' %}
+{% include 'templated_email/compiled/promote_customer.html' %}
{% endblock %}
diff --git a/templates/templated_email/html/source/dashboard/staff/promote_customer.mjml b/templates/templated_email/source/dashboard/staff/promote_customer.mjml
similarity index 100%
rename from templates/templated_email/html/source/dashboard/staff/promote_customer.mjml
rename to templates/templated_email/source/dashboard/staff/promote_customer.mjml
diff --git a/templates/templated_email/dashboard/staff/set_password.email b/templates/templated_email/source/dashboard/staff/set_password.email
similarity index 91%
rename from templates/templated_email/dashboard/staff/set_password.email
rename to templates/templated_email/source/dashboard/staff/set_password.email
index c14ce53145..502733d3e0 100644
--- a/templates/templated_email/dashboard/staff/set_password.email
+++ b/templates/templated_email/source/dashboard/staff/set_password.email
@@ -17,5 +17,5 @@ This is an automatically generated email, please do not reply.
{% endblock %}
{% block html %}
-{% include 'templated_email/html/compiled/set_password.html' %}
+{% include 'templated_email/compiled/set_password.html' %}
{% endblock %}
diff --git a/templates/templated_email/html/source/dashboard/staff/set_password.mjml b/templates/templated_email/source/dashboard/staff/set_password.mjml
similarity index 100%
rename from templates/templated_email/html/source/dashboard/staff/set_password.mjml
rename to templates/templated_email/source/dashboard/staff/set_password.mjml
diff --git a/templates/templated_email/order/confirm_order.email b/templates/templated_email/source/order/confirm_order.email
similarity index 95%
rename from templates/templated_email/order/confirm_order.email
rename to templates/templated_email/source/order/confirm_order.email
index a2e6f093a9..02852b2f68 100644
--- a/templates/templated_email/order/confirm_order.email
+++ b/templates/templated_email/source/order/confirm_order.email
@@ -34,5 +34,5 @@ Sincerely,
{% endblock %}
{% block html %}
-{% include 'templated_email/html/compiled/confirm_order.html' %}
+{% include 'templated_email/compiled/confirm_order.html' %}
{% endblock %}
diff --git a/templates/templated_email/html/source/order/confirm_order.mjml b/templates/templated_email/source/order/confirm_order.mjml
similarity index 100%
rename from templates/templated_email/html/source/order/confirm_order.mjml
rename to templates/templated_email/source/order/confirm_order.mjml
diff --git a/templates/templated_email/order/note/confirm_note.email b/templates/templated_email/source/order/note/confirm_note.email
similarity index 87%
rename from templates/templated_email/order/note/confirm_note.email
rename to templates/templated_email/source/order/note/confirm_note.email
index adc5206e45..fd1dc1cfaf 100644
--- a/templates/templated_email/order/note/confirm_note.email
+++ b/templates/templated_email/source/order/note/confirm_note.email
@@ -19,5 +19,5 @@ Sincerely,
{% endblock %}
{% block html %}
-{% include 'templated_email/html/compiled/confirm_note.html' %}
+{% include 'templated_email/compiled/confirm_note.html' %}
{% endblock %}
diff --git a/templates/templated_email/html/source/order/note/confirm_note.mjml b/templates/templated_email/source/order/note/confirm_note.mjml
similarity index 100%
rename from templates/templated_email/html/source/order/note/confirm_note.mjml
rename to templates/templated_email/source/order/note/confirm_note.mjml
diff --git a/templates/templated_email/html/source/order/partials/_order_lines.mjml b/templates/templated_email/source/order/partials/_order_lines.mjml
similarity index 100%
rename from templates/templated_email/html/source/order/partials/_order_lines.mjml
rename to templates/templated_email/source/order/partials/_order_lines.mjml
diff --git a/templates/templated_email/order/payment/confirm_payment.email b/templates/templated_email/source/order/payment/confirm_payment.email
similarity index 86%
rename from templates/templated_email/order/payment/confirm_payment.email
rename to templates/templated_email/source/order/payment/confirm_payment.email
index 702156eefb..e46595464c 100644
--- a/templates/templated_email/order/payment/confirm_payment.email
+++ b/templates/templated_email/source/order/payment/confirm_payment.email
@@ -19,5 +19,5 @@ Sincerely,
{% endblock %}
{% block html %}
-{% include 'templated_email/html/compiled/confirm_payment.html' %}
+{% include 'templated_email/compiled/confirm_payment.html' %}
{% endblock %}
diff --git a/templates/templated_email/html/source/order/payment/confirm_payment.mjml b/templates/templated_email/source/order/payment/confirm_payment.mjml
similarity index 100%
rename from templates/templated_email/html/source/order/payment/confirm_payment.mjml
rename to templates/templated_email/source/order/payment/confirm_payment.mjml
diff --git a/templates/templated_email/html/source/shared/footer.mjml b/templates/templated_email/source/shared/footer.mjml
similarity index 100%
rename from templates/templated_email/html/source/shared/footer.mjml
rename to templates/templated_email/source/shared/footer.mjml
diff --git a/templates/templated_email/html/source/shared/header.mjml b/templates/templated_email/source/shared/header.mjml
similarity index 100%
rename from templates/templated_email/html/source/shared/header.mjml
rename to templates/templated_email/source/shared/header.mjml
diff --git a/templates/templated_email/html/source/shared/styles.mjml b/templates/templated_email/source/shared/styles.mjml
similarity index 100%
rename from templates/templated_email/html/source/shared/styles.mjml
rename to templates/templated_email/source/shared/styles.mjml
diff --git a/tests/dashboard/test_staff.py b/tests/dashboard/test_staff.py
index ceed5419f6..afba112ef9 100644
--- a/tests/dashboard/test_staff.py
+++ b/tests/dashboard/test_staff.py
@@ -97,7 +97,7 @@ def test_send_set_password_email(staff_user):
'uid': urlsafe_base64_encode(force_bytes(staff_user.pk)).decode(),
'token': default_token_generator.make_token(staff_user)}
send_templated_mail(
- template_name='dashboard/staff/set_password',
+ template_name='source/dashboard/staff/set_password',
from_email=DEFAULT_FROM_EMAIL,
recipient_list=[staff_user.email],
context=ctx)