From 678e6a5d59fa5c2dacfb40b66e46614b424614ef Mon Sep 17 00:00:00 2001 From: Georgios Anastasiou Date: Mon, 8 Jan 2018 13:47:28 +0200 Subject: [PATCH] Fixed to pass test --- lib/models/lists.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/models/lists.js b/lib/models/lists.js index 79c48888..0b208673 100644 --- a/lib/models/lists.js +++ b/lib/models/lists.js @@ -81,17 +81,20 @@ module.exports.getListsWithEmail = (email, callback) => { const results = []; lists.forEach((list, index, arr) => { subscriptions.getByEmail(list.id, email, (err, sub) => { + if (err) { + return callback(err); + } if (sub) { results.push(list.id); } 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) => { resolveCid(cid, (err, id) => {