This commit is contained in:
barisusakli
2015-10-19 12:59:40 -04:00
parent f17ba88c0f
commit 7f66494a57
2 changed files with 6 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
var async = require('async');
var winston = require('winston');
var nconf = require('nconf');
var validator = require('validator');
var websockets = require('./index');
var user = require('../user');
@@ -64,7 +65,7 @@ SocketHelpers.sendNotificationToPostOwner = function(pid, fromuid, notification)
}
notifications.create({
bodyShort: '[[' + notification + ', ' + results.username + ', ' + results.topicTitle + ']]',
bodyShort: '[[' + notification + ', ' + results.username + ', ' + validator.escape(results.topicTitle) + ']]',
bodyLong: results.postObj.content,
pid: pid,
nid: 'post:' + pid + ':uid:' + fromuid,
@@ -86,14 +87,14 @@ SocketHelpers.sendNotificationToTopicOwner = function(tid, fromuid, notification
async.parallel({
username: async.apply(user.getUserField, fromuid, 'username'),
topicData: async.apply(topics.getTopicFields, tid, ['uid', 'slug']),
topicData: async.apply(topics.getTopicFields, tid, ['uid', 'slug', 'title']),
}, function(err, results) {
if (err || fromuid === parseInt(results.topicData.uid, 10)) {
return;
}
notifications.create({
bodyShort: '[[' + notification + ', ' + results.username + ']]',
bodyShort: '[[' + notification + ', ' + results.username + ', ' + validator.escape(results.topicData.title) + ']]',
path: nconf.get('relative_path') + '/topic/' + results.topicData.slug,
nid: 'tid:' + tid + ':uid:' + fromuid,
from: fromuid