mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
fix: #8018, allow absolute urls in notification.path
This commit is contained in:
@@ -65,6 +65,9 @@ Notifications.getMultiple = async function (nids) {
|
|||||||
|
|
||||||
notifications.forEach(function (notification, index) {
|
notifications.forEach(function (notification, index) {
|
||||||
if (notification) {
|
if (notification) {
|
||||||
|
if (notification.path && !notification.path.startsWith('http')) {
|
||||||
|
notification.path = nconf.get('relative_path') + notification.path;
|
||||||
|
}
|
||||||
notification.datetimeISO = utils.toISOString(notification.datetime);
|
notification.datetimeISO = utils.toISOString(notification.datetime);
|
||||||
|
|
||||||
if (notification.bodyLong) {
|
if (notification.bodyLong) {
|
||||||
@@ -168,6 +171,7 @@ async function pushToUids(uids, notification) {
|
|||||||
await async.eachLimit(uids, 3, function (uid, next) {
|
await async.eachLimit(uids, 3, function (uid, next) {
|
||||||
emailer.send('notification', uid, {
|
emailer.send('notification', uid, {
|
||||||
path: notification.path,
|
path: notification.path,
|
||||||
|
notification_url: notification.path.startsWith('http') ? notification.path : nconf.get('url') + notification.path,
|
||||||
subject: utils.stripHTMLTags(notification.subject || '[[notifications:new_notification]]'),
|
subject: utils.stripHTMLTags(notification.subject || '[[notifications:new_notification]]'),
|
||||||
intro: utils.stripHTMLTags(notification.bodyShort),
|
intro: utils.stripHTMLTags(notification.bodyShort),
|
||||||
body: notification.bodyLong || '',
|
body: notification.bodyLong || '',
|
||||||
|
|||||||
@@ -81,9 +81,12 @@ Digest.send = async function (data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
notifications.forEach(function (notification) {
|
notifications.forEach(function (n) {
|
||||||
if (notification.image && !notification.image.startsWith('http')) {
|
if (n.image && !n.image.startsWith('http')) {
|
||||||
notification.image = nconf.get('url') + notification.image;
|
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 -->
|
<!-- ENDIF notifications.image -->
|
||||||
</td>
|
</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;">
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" style="margin: auto;">
|
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" style="margin: auto;">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border-radius: 3px; background: #222222; text-align: center;" class="button-td">
|
<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 -->]] →</span>
|
<span style="color:#ffffff;" class="button-link">[[email:notif.cta<!-- IF notification.cta-type -->-{notification.cta-type}<!-- END -->]] →</span>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user