mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 18:56:15 +01:00
Filter out any undefined events
This commit is contained in:
@@ -53,7 +53,10 @@ 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] || ''));
|
||||
@@ -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]];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user