aboutsummaryrefslogtreecommitdiff
path: root/lib/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/app.js')
-rw-r--r--lib/app.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/app.js b/lib/app.js
index f475bd2..6990aa5 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -283,6 +283,24 @@ App.prototype.streamChannels = function (opts) {
}
App.prototype.streamMyChannels = function (id, opts) {
+ // use ssb-query plugin if it is available, since it has an index for
+ // author + type
+ if (this.sbot.query) return pull(
+ this.sbot.query.read({
+ reverse: true,
+ query: [
+ {$filter: {
+ value: {
+ author: id,
+ content: {type: 'channel', subscribed: true}
+ }
+ }},
+ {$map: ['value', 'content', 'channel']}
+ ]
+ }),
+ pull.unique()
+ )
+
return pull(
this.sbot.createUserStream({id: id, reverse: true}),
this.unboxMessages(),