Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Restructure emails and commands so it works on Windows
Patryk Zawadzki967c8360846b
diff --git a/.gitignore b/.gitignoreindex 628711b011..316ab68275 100644--- a/.gitignore+++ b/.gitignore@@ -28,4 +28,5 @@ dist//static//saleor/static/assets/webpack-bundle.json-/templates/templated_email/compiled/+/templates/templated_email/compiled/*+!/templates/templated_email/compiled/.gitkeepdiff --git a/docs/customization/emails.rst b/docs/customization/emails.rstindex 3c64059eb7..c6ea6eb5b6 100644--- a/docs/customization/emails.rst+++ b/docs/customization/emails.rst@@ -11,9 +11,11 @@ Emails are sent with `Django-Templated-Email <https://github.com/vintasoftware/dCustomizing Email Templates-----------------------------Templates for emails live in ``templates/templated_email`` which has two subdirectories. ``source`` directory contains ``*.email`` and ``*.mjml`` files next to each other, grouped by apps' name. Those MJML files are compiled to ``*.html`` and put into ``compiled`` directory.+Templates for emails live in ``templates/templated_email``. App-specific directories contain ``*.email`` files that define each specific message type.-Plain emails in ``*.email`` include HTML version by referencing compiled ``*.html`` files.+The ``source`` directory contains ``*.mjml`` files. Those MJML files are compiled to ``*.html`` and put into ``compiled`` directory.++Emails defined in ``*.email`` files include their HTML versions by referencing the compiled ``*.html`` files.Compiling MJMLdiff --git a/package-lock.json b/package-lock.jsonindex 69fe37677a..7997c8e9fb 100644--- a/package-lock.json+++ b/package-lock.json@@ -11387,9 +11387,9 @@}},"node-sass": {- "version": "4.8.3",- "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.8.3.tgz",- "integrity": "sha512-tfFWhUsCk/Y19zarDcPo5xpj+IW3qCfOjVdHtYeG6S1CKbQOh1zqylnQK6cV3z9k80yxAnFX9Y+a9+XysDhhfg==",+ "version": "4.9.0",+ "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.9.0.tgz",+ "integrity": "sha512-QFHfrZl6lqRU3csypwviz2XLgGNOoWQbo2GOvtsfQqOfL4cy1BtWnhx/XUeAO9LT3ahBzSRXcEO6DdvAH9DzSg==","dev": true,"requires": {"async-foreach": "0.1.3",diff --git a/package.json b/package.jsonindex b49c09e7e1..05d32fdb44 100644--- a/package.json+++ b/package.json@@ -59,7 +59,7 @@"file-loader": "^1.1.11","mini-css-extract-plugin": "^0.4.0","mjml": "^3.3.5",- "node-sass": "^4.8.3",+ "node-sass": "^4.9.0","postcss": "^6.0.21","postcss-loader": "^2.1.3","sass-loader": "^6.0.7",@@ -89,6 +89,6 @@"build-assets": "webpack -p --progress","heroku-postbuild": "npm run build-assets && npm run build-emails","start": "webpack -d --watch --progress",- "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 mjml -l skip {} -o templates/templated_email/compiled/ \\;"+ "build-emails": "mjml -l skip \"templates/templated_email/source/*.mjml\" -o templates/templated_email/compiled"}}diff --git a/saleor/account/emails.py b/saleor/account/emails.pyindex 1d3c69b822..ea64d8e5ce 100644--- a/saleor/account/emails.py+++ b/saleor/account/emails.py@@ -14,7 +14,7 @@ def send_password_reset_email(context, recipient):kwargs={'uidb64': context['uid'], 'token': context['token']}))context['reset_url'] = reset_urlsend_templated_mail(- template_name='source/account/password_reset',+ template_name='account/password_reset',from_email=settings.DEFAULT_FROM_EMAIL,recipient_list=[recipient],context=context)diff --git a/saleor/dashboard/emails.py b/saleor/dashboard/emails.pyindex 173ac37fde..266c7f6a72 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='source/dashboard/staff/set_password',+ template_name='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='source/dashboard/staff/promote_customer',+ template_name='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.pyindex 2d22c79f4b..521d2c3d58 100644--- a/saleor/order/emails.py+++ b/saleor/order/emails.py@@ -8,11 +8,11 @@ from ..core.utils import build_absolute_urifrom ..seo.schema.email import get_order_confirmation_markupfrom .models import Fulfillment, Order-CONFIRM_ORDER_TEMPLATE = 'source/order/confirm_order'-CONFIRM_FULFILLMENT_TEMPLATE = 'source/order/confirm_fulfillment'-UPDATE_FULFILLMENT_TEMPLATE = 'source/order/update_fulfillment'-CONFIRM_PAYMENT_TEMPLATE = 'source/order/payment/confirm_payment'-CONFIRM_NOTE_TEMPLATE = 'source/order/note/confirm_note'+CONFIRM_ORDER_TEMPLATE = 'order/confirm_order'+CONFIRM_FULFILLMENT_TEMPLATE = 'order/confirm_fulfillment'+UPDATE_FULFILLMENT_TEMPLATE = 'order/update_fulfillment'+CONFIRM_PAYMENT_TEMPLATE = 'order/payment/confirm_payment'+CONFIRM_NOTE_TEMPLATE = 'order/note/confirm_note'def get_email_context(order_token):diff --git a/templates/templated_email/source/account/password_reset.email b/templates/templated_email/account/password_reset.emailsimilarity index 100%rename from templates/templated_email/source/account/password_reset.emailrename to templates/templated_email/account/password_reset.emaildiff --git a/templates/templated_email/compiled/.gitkeep b/templates/templated_email/compiled/.gitkeepnew file mode 100644index 0000000000..e69de29bb2diff --git a/templates/templated_email/source/dashboard/staff/promote_customer.email b/templates/templated_email/dashboard/staff/promote_customer.emailsimilarity index 100%rename from templates/templated_email/source/dashboard/staff/promote_customer.emailrename to templates/templated_email/dashboard/staff/promote_customer.emaildiff --git a/templates/templated_email/source/dashboard/staff/set_password.email b/templates/templated_email/dashboard/staff/set_password.emailsimilarity index 100%rename from templates/templated_email/source/dashboard/staff/set_password.emailrename to templates/templated_email/dashboard/staff/set_password.emaildiff --git a/templates/templated_email/source/order/confirm_fulfillment.email b/templates/templated_email/order/confirm_fulfillment.emailsimilarity index 100%rename from templates/templated_email/source/order/confirm_fulfillment.emailrename to templates/templated_email/order/confirm_fulfillment.emaildiff --git a/templates/templated_email/source/order/confirm_order.email b/templates/templated_email/order/confirm_order.emailsimilarity index 100%rename from templates/templated_email/source/order/confirm_order.emailrename to templates/templated_email/order/confirm_order.emaildiff --git a/templates/templated_email/source/order/note/confirm_note.email b/templates/templated_email/order/note/confirm_note.emailsimilarity index 100%rename from templates/templated_email/source/order/note/confirm_note.emailrename to templates/templated_email/order/note/confirm_note.emaildiff --git a/templates/templated_email/source/order/payment/confirm_payment.email b/templates/templated_email/order/payment/confirm_payment.emailsimilarity index 100%rename from templates/templated_email/source/order/payment/confirm_payment.emailrename to templates/templated_email/order/payment/confirm_payment.emaildiff --git a/templates/templated_email/source/order/update_fulfillment.email b/templates/templated_email/order/update_fulfillment.emailsimilarity index 100%rename from templates/templated_email/source/order/update_fulfillment.emailrename to templates/templated_email/order/update_fulfillment.emaildiff --git a/templates/templated_email/source/order/confirm_fulfillment.mjml b/templates/templated_email/source/confirm_fulfillment.mjmlsimilarity index 89%rename from templates/templated_email/source/order/confirm_fulfillment.mjmlrename to templates/templated_email/source/confirm_fulfillment.mjmlindex 4afe3a530d..edcf1e98bd 100644--- a/templates/templated_email/source/order/confirm_fulfillment.mjml+++ b/templates/templated_email/source/confirm_fulfillment.mjml@@ -1,6 +1,6 @@<mjml><mj-head>- <mj-include path="../shared/styles" />+ <mj-include path="./shared/styles" /></mj-head><mj-body><mj-container>@@ -11,7 +11,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../shared/header" />+ <mj-include path="./shared/header" /><mj-section><mj-column><mj-text font-size="16px">@@ -30,7 +30,7 @@</mj-column></mj-section><mj-include path="./partials/_fulfillment_lines" />- <mj-include path="../shared/footer" />+ <mj-include path="./shared/footer" /></mj-container></mj-body></mjml>diff --git a/templates/templated_email/source/order/note/confirm_note.mjml b/templates/templated_email/source/confirm_note.mjmlsimilarity index 84%rename from templates/templated_email/source/order/note/confirm_note.mjmlrename to templates/templated_email/source/confirm_note.mjmlindex 43d5b2d55b..2ac9ba2754 100644--- a/templates/templated_email/source/order/note/confirm_note.mjml+++ b/templates/templated_email/source/confirm_note.mjml@@ -1,6 +1,6 @@<mjml><mj-head>- <mj-include path="../../shared/styles" />+ <mj-include path="./shared/styles" /></mj-head><mj-body><mj-container>@@ -11,7 +11,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../../shared/header" />+ <mj-include path="./shared/header" /><mj-section><mj-column><mj-text font-size="16px">@@ -24,7 +24,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../../shared/footer" />+ <mj-include path="./shared/footer" /></mj-container></mj-body></mjml>diff --git a/templates/templated_email/source/order/confirm_order.mjml b/templates/templated_email/source/confirm_order.mjmlsimilarity index 93%rename from templates/templated_email/source/order/confirm_order.mjmlrename to templates/templated_email/source/confirm_order.mjmlindex 954cbcd68f..b89d6881e2 100644--- a/templates/templated_email/source/order/confirm_order.mjml+++ b/templates/templated_email/source/confirm_order.mjml@@ -1,6 +1,6 @@<mjml><mj-head>- <mj-include path="../shared/styles" />+ <mj-include path="./shared/styles" /></mj-head><mj-body><mj-container>@@ -12,7 +12,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../shared/header" />+ <mj-include path="./shared/header" /><mj-section><mj-column><mj-text font-size="16px">@@ -52,7 +52,7 @@</mj-table></mj-column></mj-section>- <mj-include path="../shared/footer" />+ <mj-include path="./shared/footer" /></mj-container></mj-body></mjml>diff --git a/templates/templated_email/source/order/payment/confirm_payment.mjml b/templates/templated_email/source/confirm_payment.mjmlsimilarity index 84%rename from templates/templated_email/source/order/payment/confirm_payment.mjmlrename to templates/templated_email/source/confirm_payment.mjmlindex 21aa1a9069..a456deb6b9 100644--- a/templates/templated_email/source/order/payment/confirm_payment.mjml+++ b/templates/templated_email/source/confirm_payment.mjml@@ -1,6 +1,6 @@<mjml><mj-head>- <mj-include path="../../shared/styles" />+ <mj-include path="./shared/styles" /></mj-head><mj-body><mj-container>@@ -11,7 +11,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../../shared/header" />+ <mj-include path="./shared/header" /><mj-section><mj-column><mj-text font-size="16px">@@ -24,7 +24,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../../shared/footer" />+ <mj-include path="./shared/footer" /></mj-container></mj-body></mjml>diff --git a/templates/templated_email/source/order/partials/_fulfillment_lines.mjml b/templates/templated_email/source/partials/_fulfillment_lines.mjmlsimilarity index 100%rename from templates/templated_email/source/order/partials/_fulfillment_lines.mjmlrename to templates/templated_email/source/partials/_fulfillment_lines.mjmldiff --git a/templates/templated_email/source/order/partials/_order_lines.mjml b/templates/templated_email/source/partials/_order_lines.mjmlsimilarity index 100%rename from templates/templated_email/source/order/partials/_order_lines.mjmlrename to templates/templated_email/source/partials/_order_lines.mjmldiff --git a/templates/templated_email/source/account/password_reset.mjml b/templates/templated_email/source/password_reset.mjmlsimilarity index 89%rename from templates/templated_email/source/account/password_reset.mjmlrename to templates/templated_email/source/password_reset.mjmlindex a5019a20ae..0ff91d9008 100644--- a/templates/templated_email/source/account/password_reset.mjml+++ b/templates/templated_email/source/password_reset.mjml@@ -1,6 +1,6 @@<mjml><mj-head>- <mj-include path="../shared/styles" />+ <mj-include path="./shared/styles" /></mj-head><mj-body><mj-container>@@ -11,7 +11,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../shared/header" />+ <mj-include path="./shared/header" /><mj-section><mj-column><mj-text font-size="16px">@@ -30,7 +30,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../shared/footer" />+ <mj-include path="./shared/footer" /></mj-container></mj-body></mjml>diff --git a/templates/templated_email/source/dashboard/staff/promote_customer.mjml b/templates/templated_email/source/promote_customer.mjmlsimilarity index 86%rename from templates/templated_email/source/dashboard/staff/promote_customer.mjmlrename to templates/templated_email/source/promote_customer.mjmlindex 0990ce2d3e..d767f19f27 100644--- a/templates/templated_email/source/dashboard/staff/promote_customer.mjml+++ b/templates/templated_email/source/promote_customer.mjml@@ -1,6 +1,6 @@<mjml><mj-head>- <mj-include path="../../shared/styles" />+ <mj-include path="./shared/styles" /></mj-head><mj-body><mj-container>@@ -11,7 +11,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../../shared/header" />+ <mj-include path="./shared/header" /><mj-section><mj-column><mj-text font-size="16px">@@ -25,7 +25,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../../shared/footer" />+ <mj-include path="./shared/footer" /></mj-container></mj-body></mjml>diff --git a/templates/templated_email/source/dashboard/staff/set_password.mjml b/templates/templated_email/source/set_password.mjmlsimilarity index 88%rename from templates/templated_email/source/dashboard/staff/set_password.mjmlrename to templates/templated_email/source/set_password.mjmlindex 888fc3eac6..aa3ee224a5 100644--- a/templates/templated_email/source/dashboard/staff/set_password.mjml+++ b/templates/templated_email/source/set_password.mjml@@ -1,6 +1,6 @@<mjml><mj-head>- <mj-include path="../../shared/styles" />+ <mj-include path="./shared/styles" /></mj-head><mj-body><mj-container>@@ -11,7 +11,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../../shared/header" />+ <mj-include path="./shared/header" /><mj-section><mj-column><mj-text font-size="16px">@@ -30,7 +30,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../../shared/footer" />+ <mj-include path="./shared/footer" /></mj-container></mj-body></mjml>diff --git a/templates/templated_email/source/order/update_fulfillment.mjml b/templates/templated_email/source/update_fulfillment.mjmlsimilarity index 89%rename from templates/templated_email/source/order/update_fulfillment.mjmlrename to templates/templated_email/source/update_fulfillment.mjmlindex f59fbdcb17..653cde1ad8 100644--- a/templates/templated_email/source/order/update_fulfillment.mjml+++ b/templates/templated_email/source/update_fulfillment.mjml@@ -1,6 +1,6 @@<mjml><mj-head>- <mj-include path="../shared/styles" />+ <mj-include path="./shared/styles" /></mj-head><mj-body><mj-container>@@ -11,7 +11,7 @@</mj-text></mj-column></mj-section>- <mj-include path="../shared/header" />+ <mj-include path="./shared/header" /><mj-section><mj-column><mj-text font-size="16px">@@ -30,7 +30,7 @@</mj-column></mj-section><mj-include path="./partials/_fulfillment_lines" />- <mj-include path="../shared/footer" />+ <mj-include path="./shared/footer" /></mj-container></mj-body></mjml>diff --git a/tests/dashboard/test_staff.py b/tests/dashboard/test_staff.pyindex adc7db09f2..76639487f0 100644--- a/tests/dashboard/test_staff.py+++ b/tests/dashboard/test_staff.py@@ -105,7 +105,7 @@ def test_send_set_password_email(staff_user, site_settings):'uid': urlsafe_base64_encode(force_bytes(staff_user.pk)).decode(),'token': default_token_generator.make_token(staff_user)}send_templated_mail(- template_name='source/dashboard/staff/set_password',+ template_name='dashboard/staff/set_password',from_email=DEFAULT_FROM_EMAIL,recipient_list=[staff_user.email],context=ctx)