diff --git a/public/images/emails/banneduser.png b/public/images/emails/banneduser.png deleted file mode 100644 index 4eac70d8ca..0000000000 Binary files a/public/images/emails/banneduser.png and /dev/null differ diff --git a/public/images/emails/digestheader.jpg b/public/images/emails/digestheader.jpg deleted file mode 100644 index 4c873e41b7..0000000000 Binary files a/public/images/emails/digestheader.jpg and /dev/null differ diff --git a/public/images/emails/emailconfirm.png b/public/images/emails/emailconfirm.png deleted file mode 100644 index d066015bd9..0000000000 Binary files a/public/images/emails/emailconfirm.png and /dev/null differ diff --git a/public/images/emails/invitation.png b/public/images/emails/invitation.png deleted file mode 100644 index 283372c9fa..0000000000 Binary files a/public/images/emails/invitation.png and /dev/null differ diff --git a/public/images/emails/newtopic.png b/public/images/emails/newtopic.png deleted file mode 100644 index bc5718563a..0000000000 Binary files a/public/images/emails/newtopic.png and /dev/null differ diff --git a/public/images/emails/nodebb.png b/public/images/emails/nodebb.png deleted file mode 100644 index 9cfe1cd70c..0000000000 Binary files a/public/images/emails/nodebb.png and /dev/null differ diff --git a/public/images/emails/notification.png b/public/images/emails/notification.png deleted file mode 100644 index 0e10a1580c..0000000000 Binary files a/public/images/emails/notification.png and /dev/null differ diff --git a/public/images/emails/password.png b/public/images/emails/password.png deleted file mode 100644 index 7a7358e082..0000000000 Binary files a/public/images/emails/password.png and /dev/null differ diff --git a/public/images/emails/triangularbackground.png b/public/images/emails/triangularbackground.png deleted file mode 100644 index c47ad51810..0000000000 Binary files a/public/images/emails/triangularbackground.png and /dev/null differ diff --git a/public/images/emails/unreadpost.png b/public/images/emails/unreadpost.png deleted file mode 100644 index 8228478618..0000000000 Binary files a/public/images/emails/unreadpost.png and /dev/null differ diff --git a/public/language/en-GB/email.json b/public/language/en-GB/email.json index 813ba0f2ce..1e083e0651 100644 --- a/public/language/en-GB/email.json +++ b/public/language/en-GB/email.json @@ -32,11 +32,11 @@ "digest.latest_topics": "Latest topics from %1", "digest.cta": "Click here to visit %1", "digest.unsub.info": "This digest was sent to you due to your subscription settings.", - "digest.no_topics": "There have been no active topics in the past %1", "digest.day": "day", "digest.week": "week", "digest.month": "month", "digest.subject": "Digest for %1", + "digest.title": "Your Daily Digest", "notif.chat.subject": "New chat message received from %1", "notif.chat.cta": "Click here to continue the conversation", diff --git a/public/src/modules/helpers.js b/public/src/modules/helpers.js index b6d56c9e7b..d1b7a989d0 100644 --- a/public/src/modules/helpers.js +++ b/public/src/modules/helpers.js @@ -205,14 +205,14 @@ function renderDigestAvatar(block) { if (block.teaser) { if (block.teaser.user.picture) { - return ''; + return ''; } - return '
' + block.teaser.user['icon:text'] + '
'; + return '
' + block.teaser.user['icon:text'] + '
'; } if (block.user.picture) { - return ''; + return ''; } - return '
' + block.user['icon:text'] + '
'; + return '
' + block.user['icon:text'] + '
'; } function userAgentIcons(data) { diff --git a/src/emailer.js b/src/emailer.js index 33048b7ed1..d0f859efd7 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -195,12 +195,13 @@ Emailer.send = function (template, uid, params, callback) { settings: async.apply(User.getSettings, uid), }, next); }, - function (results, next) { + async function (results, next) { if (!results.email) { winston.warn('uid : ' + uid + ' has no email, not sending.'); return next(); } params.uid = uid; + params.rtl = await translator.translate('[[language:dir]]', results.settings.userLang) === 'rtl'; Emailer.sendToEmail(template, results.email, results.settings.userLang, params, next); }, ], callback); @@ -282,6 +283,7 @@ Emailer.sendToEmail = function (template, email, language, params, callback) { pid: params.pid, fromUid: params.fromUid, headers: params.headers, + rtl: params.rtl, }; Plugins.fireHook('filter:email.modify', data, next); }, diff --git a/src/socket.io/admin.js b/src/socket.io/admin.js index 76a3ca6476..a8c0537e20 100644 --- a/src/socket.io/admin.js +++ b/src/socket.io/admin.js @@ -296,8 +296,9 @@ SocketAdmin.email.test = function (socket, data, callback) { showUnsubscribe: true, }, next); }, - ]); + ], callback); break; + default: emailer.send(data.template, socket.uid, payload, callback); break; diff --git a/src/topics/teaser.js b/src/topics/teaser.js index b2e2f57758..2ff12db4a8 100644 --- a/src/topics/teaser.js +++ b/src/topics/teaser.js @@ -23,6 +23,7 @@ module.exports = function (Topics) { var teaserPids = []; var postData; var tidToPost = {}; + const teaserPost = this ? this.teaserPost : meta.config.teaserPost; topics.forEach(function (topic) { counts.push(topic && topic.postcount); @@ -30,9 +31,9 @@ module.exports = function (Topics) { if (topic.teaserPid === 'null') { delete topic.teaserPid; } - if (meta.config.teaserPost === 'first') { + if (teaserPost === 'first') { teaserPids.push(topic.mainPid); - } else if (meta.config.teaserPost === 'last-post') { + } else if (teaserPost === 'last-post') { teaserPids.push(topic.teaserPid || topic.mainPid); } else { // last-reply and everything else uses teaserPid like `last` that was used before teaserPids.push(topic.teaserPid); diff --git a/src/user/digest.js b/src/user/digest.js index 8feb9b4dd9..2ece74489a 100644 --- a/src/user/digest.js +++ b/src/user/digest.js @@ -180,8 +180,24 @@ Digest.send = function (data, callback) { next(null, data); } }, - function (data, next) { - next(null, data.topics); + (data, next) => { + // Re-generate teasers with different teaserPost option + topics.getTeasers.bind({ teaserPost: 'last-post' })(data.topics, uid, function (err, teasers) { + if (err) { + return next(err); + } + + data.topics.map(function (topicObj, i) { + if (teasers[i].content.length > 255) { + teasers[i].content = teasers[i].content.slice(0, 255) + '...'; + } + + topicObj.teaser = teasers[i]; + return topicObj; + }); + + next(null, data.topics); + }); }, ], callback); } diff --git a/src/views/emails/banned.tpl b/src/views/emails/banned.tpl index db8975c993..20d82ba8df 100644 --- a/src/views/emails/banned.tpl +++ b/src/views/emails/banned.tpl @@ -2,46 +2,41 @@ - - - - - - - - diff --git a/src/views/emails/digest.tpl b/src/views/emails/digest.tpl index 38fba1232f..c24c7fbd9a 100644 --- a/src/views/emails/digest.tpl +++ b/src/views/emails/digest.tpl @@ -3,71 +3,88 @@
- -
+ - + + + - + - +
-

[[email:greeting_with_name, {username}]]

-

- [[email:banned.text1, {username}, {site_title}]] - -

[[email:banned.text2, {until}]] - -

+
+

[[email:greeting_with_name, {username}]]

+
+

[[email:banned.text1, {username}, {site_title}]]

+

[[email:banned.text3]] -

{reason} +

+

+ {reason}

-

[[email:closing]]

-

{site_title}

+
+

+ [[email:banned.text2, {until}]] +

- - - - - - -
- -
+ - + + + - + - + - diff --git a/src/views/emails/invitation.tpl b/src/views/emails/invitation.tpl index 799ac67fd5..64d60307d1 100644 --- a/src/views/emails/invitation.tpl +++ b/src/views/emails/invitation.tpl @@ -2,33 +2,32 @@
-

[[email:greeting_with_name, {username}]],

+
+

[[email:greeting_with_name, {username}]]

+
+

[[email:digest.title]]

-

[[email:digest.notifications, {site_title}]]

-
    +
+
-

[[email:digest.latest_topics, {site_title}]]

-
    - +
+

[[email:digest.latest_topics, {site_title}]]

+
+ @@ -76,12 +93,6 @@ - - -
- +     [[email:digest.cta, {site_title}]]    
-

[[email:closing]]

-

{site_title}

-
- - - - - - - -
- -
+ - - + + + + + + diff --git a/src/views/emails/notif_chat.tpl b/src/views/emails/notif_chat.tpl deleted file mode 100644 index 275a5bf782..0000000000 --- a/src/views/emails/notif_chat.tpl +++ /dev/null @@ -1,58 +0,0 @@ - - - -
-

[[email:greeting_no_name]]

-

[[email:invitation.text1, {username}, {site_title}]]

-

[[email:invitation.text2, {expireDays}]]

+
+

[[email:greeting_no_name]]

+ +

[[email:invitation.text1, {username}, {site_title}]]

+
+

[[email:invitation.text2, {expireDays}]]

+
@@ -37,12 +36,6 @@ - - -
- +     [[email:invitation.ctr]]    
-

[[email:closing]]

-

{site_title}

-
- - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - -
-

[[email:greeting_with_name, {username}]],

-

{summary}:

-
- {message.content} -
- - - - - -
- -     [[email:notif.chat.cta]]     - -
- -
-

[[email:closing]]

-

{site_title}

-
-
- - - diff --git a/src/views/emails/notif_post.tpl b/src/views/emails/notif_post.tpl deleted file mode 100644 index 168743512f..0000000000 --- a/src/views/emails/notif_post.tpl +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - -
-

{intro}

-
- {postBody} -
- - - - - -
- -     [[email:notif.post.cta]]     - -
- -
-

[[email:closing]]

-

{site_title}

-
-
- - - diff --git a/src/views/emails/notification.tpl b/src/views/emails/notification.tpl index d1301ace7a..60579d48cd 100644 --- a/src/views/emails/notification.tpl +++ b/src/views/emails/notification.tpl @@ -3,55 +3,48 @@ - - - - - + + + + + - - - - - +
- -
+ + + + + + + + + + + + + +
+

[[email:greeting_with_name, {username}]]

+
+

{intro}

+
+

+ {body} +

+
+ + + + + +
+ +     [[email:notif.cta]]     + +
+ +
+
- - - - - - - - - - - - - -
-

{intro}

-
- {body} -
- - - - - -
- -     [[email:notif.cta]]     - -
- -
-

[[email:closing]]

-

{site_title}

-
-
+ -
- - - + diff --git a/src/views/emails/partials/footer.tpl b/src/views/emails/partials/footer.tpl index 20bbd90f0e..13b350ef23 100644 --- a/src/views/emails/partials/footer.tpl +++ b/src/views/emails/partials/footer.tpl @@ -1,7 +1,7 @@ -
+

[[email:notif.post.unsub.info]] [[email:unsub.cta]]. diff --git a/src/views/emails/partials/header.tpl b/src/views/emails/partials/header.tpl index 61867b16d3..c3185b8175 100644 --- a/src/views/emails/partials/header.tpl +++ b/src/views/emails/partials/header.tpl @@ -153,15 +153,15 @@ - -
+ +
-