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

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

Loading…
Cancel
Save