v1.18.x
barisusakli 9 years ago
parent 8d9f7d8e19
commit 07c1a822db

@ -215,11 +215,7 @@
if (value) { if (value) {
var variable; var variable;
for (var i = 1, ii = variables.length; i < ii; i++) { for (var i = 1, ii = variables.length; i < ii; i++) {
variable = S(variables[i]).chompRight(']]').collapseWhitespace().decodeHTMLEntities().escapeHTML().s;
// 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;
value = value.replace('%' + i, variable); value = value.replace('%' + i, variable);
} }

@ -100,7 +100,9 @@ module.exports = function(Topics) {
Topics.notifyFollowers = function(postData, exceptUid, callback) { Topics.notifyFollowers = function(postData, exceptUid, callback) {
callback = callback || function() {}; callback = callback || function() {};
var followers, title; var followers;
var title;
var titleEscaped;
async.waterfall([ async.waterfall([
function (next) { function (next) {
@ -126,12 +128,14 @@ module.exports = function(Topics) {
return callback(); return callback();
} }
title = postData.topic.title; title = postData.topic.title;
if (title) { if (title) {
title = S(title).decodeHTMLEntities().s; title = S(title).decodeHTMLEntities().s;
titleEscaped = title.replace(/%/g, '&#37;').replace(/,/g, '&#44;');
} }
notifications.create({ notifications.create({
bodyShort: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + title + ']]', bodyShort: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + titleEscaped + ']]',
bodyLong: postData.content, bodyLong: postData.content,
pid: postData.pid, pid: postData.pid,
nid: 'new_post:tid:' + postData.topic.tid + ':pid:' + postData.pid + ':uid:' + exceptUid, 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, { emailer.send('notif_post', toUid, {
pid: postData.pid, pid: postData.pid,
subject: '[' + (meta.config.title || 'NodeBB') + '] ' + title, 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://'), postBody: postData.content.replace(/"\/\//g, '"http://'),
site_title: meta.config.title || 'NodeBB', site_title: meta.config.title || 'NodeBB',
username: data.userData.username, username: data.userData.username,

Loading…
Cancel
Save