Fixed to pass test
This commit is contained in:
parent
c085faa157
commit
678e6a5d59
1 changed files with 5 additions and 2 deletions
|
@ -81,17 +81,20 @@ module.exports.getListsWithEmail = (email, callback) => {
|
||||||
const results = [];
|
const results = [];
|
||||||
lists.forEach((list, index, arr) => {
|
lists.forEach((list, index, arr) => {
|
||||||
subscriptions.getByEmail(list.id, email, (err, sub) => {
|
subscriptions.getByEmail(list.id, email, (err, sub) => {
|
||||||
|
if (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
if (sub) {
|
if (sub) {
|
||||||
results.push(list.id);
|
results.push(list.id);
|
||||||
}
|
}
|
||||||
if (index === arr.length - 1) {
|
if (index === arr.length - 1) {
|
||||||
callback(null, lists.filter(list => results.includes(list.id)));
|
return callback(null, lists.filter(list => results.includes(list.id)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
module.exports.getByCid = (cid, callback) => {
|
module.exports.getByCid = (cid, callback) => {
|
||||||
resolveCid(cid, (err, id) => {
|
resolveCid(cid, (err, id) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue