]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
templates: Move mails to separate directory
authorStephen Finucane <stephen@that.guru>
Wed, 6 Jun 2018 14:31:33 +0000 (15:31 +0100)
committerStephen Finucane <stephen@that.guru>
Sat, 29 Sep 2018 21:41:16 +0000 (22:41 +0100)
This makes things a little easier to parse. A couple of templates are
renamed and the 'register.mail' template, which appears to be unused
since commit f1e089f7, is removed.

Signed-off-by: Stephen Finucane <stephen@that.guru>
patchwork/notifications.py
patchwork/templates/patchwork/mails/activation-subject.txt [moved from patchwork/templates/patchwork/activation_email_subject.txt with 100% similarity]
patchwork/templates/patchwork/mails/activation.txt [moved from patchwork/templates/patchwork/activation_email.txt with 100% similarity]
patchwork/templates/patchwork/mails/optin-request.txt [moved from patchwork/templates/patchwork/optin-request.mail with 100% similarity]
patchwork/templates/patchwork/mails/optout-request.txt [moved from patchwork/templates/patchwork/optout-request.mail with 100% similarity]
patchwork/templates/patchwork/mails/patch-change-notification-subject.txt [moved from patchwork/templates/patchwork/patch-change-notification-subject.text with 100% similarity]
patchwork/templates/patchwork/mails/patch-change-notification.txt [moved from patchwork/templates/patchwork/patch-change-notification.mail with 100% similarity]
patchwork/templates/patchwork/mails/user-link.txt [moved from patchwork/templates/patchwork/user-link.mail with 100% similarity]
patchwork/templates/patchwork/register.mail [deleted file]
patchwork/views/mail.py
patchwork/views/user.py

index 3922fafa2efb07e691fc23447c45e3efe98d47bb..7be30f0a0652adcd35499c4ecfc643dce0e51181 100644 (file)
@@ -63,10 +63,11 @@ def send_notifications():
         }
 
         subject = render_to_string(
-            'patchwork/patch-change-notification-subject.text',
+            'patchwork/mails/patch-change-notification-subject.txt',
             context).strip()
-        content = render_to_string('patchwork/patch-change-notification.mail',
-                                   context)
+        content = render_to_string(
+            'patchwork/mails/patch-change-notification.txt',
+            context)
 
         message = EmailMessage(subject=subject, body=content,
                                from_email=settings.NOTIFICATION_FROM_EMAIL,
diff --git a/patchwork/templates/patchwork/register.mail b/patchwork/templates/patchwork/register.mail
deleted file mode 100644 (file)
index 51f3adf..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-Hi,
-
-This email is to confirm your account on the Patchwork patch-tracking
-system. You can activate your account by visiting the url:
-
- http://{{site.domain}}{% url 'registration_activateactivation_key'=request.key %}
-
-If you didn't request a user account on Patchwork, then you can ignore
-this mail.
-
-Happy patchworking.
index 49aa27eeba608ff3ca7b762f138d3f07b9d84ff3..f6bdbb47b5730f69000b32c38e1e5656d8f6dfdd 100644 (file)
@@ -69,7 +69,7 @@ def optin_confirm(request, conf):
 
 def _optinout(request, action, description):
     context = {}
-    mail_template = 'patchwork/%s-request.mail' % action
+    mail_template = 'patchwork/mails/%s-request.txt' % action
     html_template = 'patchwork/%s-request.html' % action
 
     if request.method != 'POST':
index 36cd4b9dddd3e77a6c5444b7ed3095ca89b14c5d..838a1abca60bc70a57c95e98510848d04df72dc2 100644 (file)
@@ -52,11 +52,13 @@ def register(request):
             conf.save()
 
             # send email
-            subject = 'Patchwork account confirmation'
+            subject = render_to_string(
+                'patchwork/mails/activation-subject.txt')
             message = render_to_string(
-                'patchwork/activation_email.txt',
+                'patchwork/mails/activation.txt',
                 {'site': Site.objects.get_current(), 'confirmation': conf})
 
+            # TODO(stephenfin): Should this be surrounded by a try-except?
             send_mail(subject, message, settings.DEFAULT_FROM_EMAIL,
                       [conf.email])
 
@@ -136,10 +138,12 @@ def link(request):
 
             context['confirmation'] = conf
 
+            subject = 'Patchwork email address confirmation',
+            message = render_to_string('patchwork/mails/user-link.txt',
+                                       context, request=request)
             try:
-                send_mail('Patchwork email address confirmation',
-                          render_to_string('patchwork/user-link.mail',
-                                           context, request=request),
+                send_mail(subject,
+                          message,
                           settings.DEFAULT_FROM_EMAIL,
                           [form.cleaned_data['email']])
             except smtplib.SMTPException: