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

@ -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);
}

@ -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,

Loading…
Cancel
Save