fix: #8018, allow absolute urls in notification.path

v1.18.x
Barış Soner Uşaklı 5 years ago
parent bfea9d3906
commit 0037a03886

@ -65,6 +65,9 @@ Notifications.getMultiple = async function (nids) {
notifications.forEach(function (notification, index) {
if (notification) {
if (notification.path && !notification.path.startsWith('http')) {
notification.path = nconf.get('relative_path') + notification.path;
}
notification.datetimeISO = utils.toISOString(notification.datetime);
if (notification.bodyLong) {
@ -168,6 +171,7 @@ async function pushToUids(uids, notification) {
await async.eachLimit(uids, 3, function (uid, next) {
emailer.send('notification', uid, {
path: notification.path,
notification_url: notification.path.startsWith('http') ? notification.path : nconf.get('url') + notification.path,
subject: utils.stripHTMLTags(notification.subject || '[[notifications:new_notification]]'),
intro: utils.stripHTMLTags(notification.bodyShort),
body: notification.bodyLong || '',

@ -81,9 +81,12 @@ Digest.send = async function (data) {
return;
}
notifications.forEach(function (notification) {
if (notification.image && !notification.image.startsWith('http')) {
notification.image = nconf.get('url') + notification.image;
notifications.forEach(function (n) {
if (n.image && !n.image.startsWith('http')) {
n.image = nconf.get('base_url') + n.image;
}
if (n.path) {
n.notification_url = n.path.startsWith('http') ? n.path : nconf.get('base_url') + n.path;
}
});

@ -33,7 +33,7 @@
<!-- ENDIF notifications.image -->
</td>
<td style="padding: 16px; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; line-height: 16px; color: #333333;">
<p style="margin: 0;"><a style="text-decoration:none !important; text-decoration:none; color: #333333;" href="{url}{notifications.path}">{notifications.bodyShort}</a></p>
<p style="margin: 0;"><a style="text-decoration:none !important; text-decoration:none; color: #333333;" href="{notifications.notification_url}">{notifications.bodyShort}</a></p>
</td>
</tr>
</table>

@ -30,7 +30,7 @@
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" style="margin: auto;">
<tr>
<td style="border-radius: 3px; background: #222222; text-align: center;" class="button-td">
<a href="{url}{path}" style="background: #222222; border: 15px solid #222222; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 13px; line-height: 1.1; text-align: center; text-decoration: none; display: block; border-radius: 3px; font-weight: bold;" class="button-a">
<a href="{notification_url}" style="background: #222222; border: 15px solid #222222; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 13px; line-height: 1.1; text-align: center; text-decoration: none; display: block; border-radius: 3px; font-weight: bold;" class="button-a">
<span style="color:#ffffff;" class="button-link">[[email:notif.cta<!-- IF notification.cta-type -->-{notification.cta-type}<!-- END -->]] &rarr;</span>
</a>
</td>

Loading…
Cancel
Save