mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
use includes instead of indexOf
use _.uniq instead of filter&indexOf
This commit is contained in:
@@ -120,11 +120,7 @@ events.getEvents = function (filter, start, stop, callback) {
|
||||
};
|
||||
|
||||
function addUserData(eventsData, field, objectName, callback) {
|
||||
var uids = eventsData.map(function (event) {
|
||||
return event && event[field];
|
||||
}).filter(function (uid, index, array) {
|
||||
return uid && array.indexOf(uid) === index;
|
||||
});
|
||||
var uids = _.uniq(eventsData.map(event => event && event[field]));
|
||||
|
||||
if (!uids.length) {
|
||||
return callback(null, eventsData);
|
||||
|
||||
Reference in New Issue
Block a user