Skip to content

Node.js based forum software built for the modern web

closes #4318 closes #4309

barisusakli07c1a822db0b
diff --git a/public/src/modules/translator.js b/public/src/modules/translator.js
index 58c8ef6f26..5892f6dde8 100644
--- a/public/src/modules/translator.js
+++ b/public/src/modules/translator.js
@@ -215,11 +215,7 @@
if (value) {
var variable;
for (var i = 1, ii = variables.length; i < ii; i++) {
-
- // see https://github.com/NodeBB/NodeBB/issues/1951
- variables[i] = variables[i].replace(/&#37;/g, '%').replace(/&#44;/g, ',');
-
- variable = S(variables[i]).chompRight(']]').collapseWhitespace().escapeHTML().s;
+ variable = S(variables[i]).chompRight(']]').collapseWhitespace().decodeHTMLEntities().escapeHTML().s;
value = value.replace('%' + i, variable);
}
diff --git a/src/topics/follow.js b/src/topics/follow.js
index dc441b1ca4..c05a796741 100644
--- a/src/topics/follow.js
+++ b/src/topics/follow.js
@@ -100,7 +100,9 @@ module.exports = function(Topics) {
Topics.notifyFollowers = function(postData, exceptUid, callback) {
callback = callback || function() {};
- var followers, title;
+ var followers;
+ var title;
+ var titleEscaped;
async.waterfall([
function (next) {
@@ -126,12 +128,14 @@ module.exports = function(Topics) {
return callback();
}
title = postData.topic.title;
+
if (title) {
title = S(title).decodeHTMLEntities().s;
+ titleEscaped = title.replace(/%/g, '&#37;').replace(/,/g, '&#44;');
}
notifications.create({
- bodyShort: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + title + ']]',
+ bodyShort: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + titleEscaped + ']]',
bodyLong: postData.content,
pid: postData.pid,
nid: 'new_post:tid:' + postData.topic.tid + ':pid:' + postData.pid + ':uid:' + exceptUid,
@@ -162,7 +166,7 @@ module.exports = function(Topics) {
emailer.send('notif_post', toUid, {
pid: postData.pid,
subject: '[' + (meta.config.title || 'NodeBB') + '] ' + title,
- intro: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + title + ']]',
+ intro: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + titleEscaped + ']]',
postBody: postData.content.replace(/"\/\//g, '"http://'),
site_title: meta.config.title || 'NodeBB',
username: data.userData.username,