Merge pull request #5131 from bdharrington7/bugfix/undefined_events

Filter out any undefined events
v1.18.x
Barış Soner Uşaklı 8 years ago committed by GitHub
commit 92c58cc62f

@ -3,7 +3,7 @@
var async = require('async');
var validator = require('validator');
var db = require('./database');
var batch = require('./batch');
var user = require('./user');
@ -53,11 +53,14 @@ var utils = require('../public/src/utils');
addUserData(eventsData, 'targetUid', 'targetUser', next);
},
function (eventsData, next) {
eventsData.forEach(function (event) {
eventsData.filter(function (element) {
return element !== undefined;
})
.forEach(function (event) {
Object.keys(event).forEach(function (key) {
if (typeof event[key] === 'string') {
event[key] = validator.escape(String(event[key] || ''));
}
event[key] = validator.escape(String(event[key] || ''));
}
});
var e = utils.merge(event);
e.eid = e.uid = e.type = e.ip = e.user = undefined;
@ -100,7 +103,9 @@ var utils = require('../public/src/utils');
map[user.uid] = user;
});
eventsData.forEach(function (event) {
eventsData.filter(function (element) {
return element !== undefined;
}).forEach(function (event) {
if (map[event[field]]) {
event[objectName] = map[event[field]];
}

Loading…
Cancel
Save