]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix email footer
authorChocobozzz <me@florianbigard.com>
Tue, 10 Nov 2020 14:56:13 +0000 (15:56 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 10 Nov 2020 14:56:13 +0000 (15:56 +0100)
Do not include notif preferences in contact form email

server/lib/emailer.ts
server/lib/emails/common/base.pug
server/tests/api/server/contact-form.ts
server/tests/api/server/email.ts

index 6532fb4b4d708b77e45d47a4076020d63e109e1f..708808cf23f75e10f50892889982017ac2af55a7 100644 (file)
@@ -606,7 +606,10 @@ class Emailer {
       locals: {
         fromName,
         fromEmail,
-        body
+        body,
+
+        // There are not notification preferences for the contact form
+        hideNotificationPreferences: true
       }
     }
 
index b66a2a6d753efa2fb5f193680e483b785f847fa1..991cd5fbe68f4c9263834745aa0694d7e7be3604 100644 (file)
@@ -199,7 +199,7 @@ body(width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule:
                       td(width="40px")
                         img(src=`${WEBSERVER.URL}/client/assets/images/icons/icon-192x192.png` width="auto" height="30px" alt="" border="0" style="height: 30px; background: #ffffff; font-family: sans-serif; font-size: 15px; line-height: 15px; color: #555555;")
                       td
-                        h1(style='margin: 10px 0 10px 0; font-family: sans-serif; font-size: 25px; line-height: 30px; color: #333333; font-weight: normal;') 
+                        h1(style='margin: 10px 0 10px 0; font-family: sans-serif; font-size: 25px; line-height: 30px; color: #333333; font-weight: normal;')
                           block title
                             if title
                               | #{title}
@@ -234,17 +234,18 @@ body(width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule:
         //- 1 Column Text : END
       //- Email Body : END
       //- Email Footer : BEGIN
-      table(align='center' role='presentation' cellspacing='0' cellpadding='0' border='0' width='100%' style='margin: auto;')
-        tr
-          td(style='padding: 20px; padding-bottom: 0px; font-family: sans-serif; font-size: 12px; line-height: 15px; text-align: center; color: #888888;')
-            webversion
-              a.nocolor(href=`${WEBSERVER.URL}/my-account/notifications` style='color: #cccccc; font-weight: bold;') View in your notifications
-            br
-        tr
-          td(style='padding: 20px; padding-top: 10px; font-family: sans-serif; font-size: 12px; line-height: 15px; text-align: center; color: #888888;')
-            unsubscribe
-              a.nocolor(href=`${WEBSERVER.URL}/my-account/settings#notifications` style='color: #888888;') Manage your notification preferences in your profile
-            br
+      unless hideNotificationPreferences
+        table(align='center' role='presentation' cellspacing='0' cellpadding='0' border='0' width='100%' style='margin: auto;')
+          tr
+            td(style='padding: 20px; padding-bottom: 0px; font-family: sans-serif; font-size: 12px; line-height: 15px; text-align: center; color: #888888;')
+              webversion
+                a.nocolor(href=`${WEBSERVER.URL}/my-account/notifications` style='color: #cccccc; font-weight: bold;') View in your notifications
+              br
+          tr
+            td(style='padding: 20px; padding-top: 10px; font-family: sans-serif; font-size: 12px; line-height: 15px; text-align: center; color: #888888;')
+              unsubscribe
+                a.nocolor(href=`${WEBSERVER.URL}/my-account/settings#notifications` style='color: #888888;') Manage your notification preferences in your profile
+              br
       //- Email Footer : END
       //if mso
     //- Full Bleed Background Section : BEGIN
index 8d1270358a2bf012b3efd7d05c977fa24323e028..c0965d9d1bd429e3302a4048a4dd489fd471ed9c 100644 (file)
@@ -83,6 +83,11 @@ describe('Test contact form', function () {
     })
   })
 
+  it('Should not have the manage preferences link in the email', async function () {
+    const email = emails[0]
+    expect(email['text']).to.not.contain('Manage your notification preferences')
+  })
+
   after(async function () {
     MockSmtpServer.Instance.kill()
 
index 05c89d2a38b69b4a891f0c136da978df7e738ae4..53f96a94fa17776150572b2accef06f597fbd348 100644 (file)
@@ -279,6 +279,11 @@ describe('Test emails', function () {
       expect(email['subject']).contains(' unblacklisted')
       expect(email['text']).contains('my super user video')
     })
+
+    it('Should have the manage preferences link in the email', async function () {
+      const email = emails[6]
+      expect(email['text']).to.contain('Manage your notification preferences')
+    })
   })
 
   describe('When verifying a user email', function () {