From 2f216a13f5ab41dd31148ad662129278fd6cd52e Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Tue, 8 Dec 2015 19:08:48 +0100 Subject: [PATCH] Remove items from feed without an origin --- app/js/utils/soundcloud.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/js/utils/soundcloud.js b/app/js/utils/soundcloud.js index e1f68c0..910c034 100644 --- a/app/js/utils/soundcloud.js +++ b/app/js/utils/soundcloud.js @@ -120,6 +120,11 @@ SoundCloud.prototype.fetchFeed = function(options) { future_href = resp.next_href return resp.collection }) + // filter out items with no origin (track-repost) + .reduce(function(tracks, item) { + if (item.origin) tracks.push(item) + return tracks + }, []) .map(function(item) { return item.origin }) @@ -182,4 +187,4 @@ function _artworkFormat(url, size) { return url.replace('-large', '-' + size); } -module.exports = new SoundCloud(); \ No newline at end of file +module.exports = new SoundCloud();