Skip to content

Node.js based forum software built for the modern web

fixes #3809

Julian Lam3314ab4b8313
diff --git a/public/src/modules/helpers.js b/public/src/modules/helpers.js
index 6946dd1d89..ed27369c27 100644
--- a/public/src/modules/helpers.js
+++ b/public/src/modules/helpers.js
@@ -175,6 +175,22 @@
}
};
+ helpers.renderDigestAvatar = function(block) {
+ if (block.teaser) {
+ if (block.teaser.user.picture) {
+ return '<img style="vertical-align: middle; width: 16px; height: 16px; padding-right: 1em;" src="' + block.teaser.user.picture + '" title="' + block.teaser.user.username + '" />';
+ } else {
+ return '<div style="width: 16px; height: 16px; line-height: 16px; font-size: 10px; margin-right: 1em; background-color: ' + block.teaser.user['icon:bgColor'] + '; color: white; text-align: center; display: inline-block;">' + block.teaser.user['icon:text'] + '</div>';
+ }
+ } else {
+ if (block.user.picture) {
+ return '<img style="vertical-align: middle; width: 16px; height: 16px; padding-right: 1em;" src="' + block.user.picture + '" title="' + block.user.username + '" />';
+ } else {
+ return '<div style="width: 16px; height: 16px; line-height: 16px; font-size: 10px; margin-right: 1em; background-color: ' + block.user['icon:bgColor'] + '; color: white; text-align: center; display: inline-block;">' + block.user['icon:text'] + '</div>';
+ }
+ }
+ };
+
exports.register = function() {
var templates;
diff --git a/src/views/emails/digest.tpl b/src/views/emails/digest.tpl
index 2dfd19077f..f558693aeb 100644
--- a/src/views/emails/digest.tpl
+++ b/src/views/emails/digest.tpl
@@ -6,7 +6,14 @@
<ul>
<!-- BEGIN notifications -->
<li style="text-decoration: none; list-style-type: none; padding-bottom: 0.5em;">
- <a href="{url}{notifications.path}"><img style="vertical-align: middle; width: 16px; height: 16px; padding-right: 1em;" src="{notifications.image}" />{notifications.bodyShort}</a>
+ <a href="{url}{notifications.path}">
+ <!-- IF notifications.image -->
+ <img style="vertical-align: middle; width: 16px; height: 16px; padding-right: 1em;" src="{notifications.image}" />
+ <!-- ELSE -->
+ <div style="width: 16px; height: 16px; line-height: 16px; font-size: 10px; margin-right: 1em; background-color: {notifications.user.icon:bgColor}; color: white; text-align: center; display: inline-block;">{notifications.user.icon:text}</div>
+ <!-- ENDIF notifications.image -->
+ {notifications.bodyShort}
+ </a>
</li>
<!-- END notifications -->
</ul>
@@ -19,7 +26,9 @@
<!-- IF recent.length -->
<!-- BEGIN recent -->
<li style="text-decoration: none; list-style-type: none; padding-bottom: 0.5em;">
- <a href="{url}/topic/{recent.slug}"><img style="vertical-align: middle; width: 16px; height: 16px; padding-right: 1em;" src="<!-- IF recent.teaser -->{recent.teaser.user.picture}<!-- ELSE -->{recent.user.picture}<!-- ENDIF recent.teaser -->" title="<!-- IF recent.teaser -->{recent.teaser.user.username}<!-- ELSE -->{recent.user.username}<!-- ENDIF recent.teaser -->" />{recent.title}</a>
+ <a href="{url}/topic/{recent.slug}">
+ {function.renderDigestAvatar}{recent.title}
+ </a>
</li>
<!-- END recent -->
<!-- ELSE -->