From 4267334f1d3b50038c43b2f41e1fb5da2e9dbd6c Mon Sep 17 00:00:00 2001 From: cel Date: Tue, 10 Apr 2018 17:40:50 -1000 Subject: Handle unsubscribed channels Fix %TzZ1kq4UOAhq8mwXAkKl/OC8QEbCbWcRqYj9Jx2UsCU=.sha256 --- lib/app.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/app.js b/lib/app.js index 9f0b883..cbbc74e 100644 --- a/lib/app.js +++ b/lib/app.js @@ -474,27 +474,29 @@ App.prototype.streamMyChannels = function (id, opts) { {$filter: { value: { author: id, - content: {type: 'channel', subscribed: true} + content: {type: 'channel'} } }}, - {$map: ['value', 'content', 'channel']} + {$map: ['value', 'content']} ] }), - pull.unique() + pull.unique('channel'), + pull.filter('subscribed'), + pull.map('channel') ) return pull( this.sbot.createUserStream({id: id, reverse: true}), this.unboxMessages(), - pull.filter(function (msg) { - if (msg.value.content.type == 'channel') { - return msg.value.content.subscribed - } - }), pull.map(function (msg) { - return msg.value.content.channel + return msg.value.content }), - pull.unique() + pull.filter(function (c) { + return c.type === 'channel' + }), + pull.unique('channel'), + pull.filter('subscribed'), + pull.map('channel') ) } -- cgit v1.2.3