From 47dda2fa1ff7e9e2cc281278bf33e79e46a38873 Mon Sep 17 00:00:00 2001 From: cel Date: Tue, 13 Jun 2017 19:32:59 -1000 Subject: Specify backlinks index manually as mentioned in %CoRaVRWYmwF/ywtUqqBBb4P9N8zDn+JltO9t1FQJaHE=.sha256, to allow showing all message types in backlinks streams (channels, mentions), which was said to be not possible in %hn7lMbo+MNhb4I/M+tGPEZmMbQKb/N0DnSUzSrYCA28=.sha256. This requires ssb-backlinks v0.2.0 %HH16c+LOnvotjwXtQi4JuG9OV2lf7vREmsOnseQmlVA=.sha256 --- lib/app.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'lib/app.js') diff --git a/lib/app.js b/lib/app.js index 873dedd..08a6c6c 100644 --- a/lib/app.js +++ b/lib/app.js @@ -473,10 +473,19 @@ App.prototype.streamEmojis = function () { } App.prototype.filter = function (plugin, opts, filter) { + // work around flumeview-query not picking the best index. + // %b+QdyLFQ21UGYwvV3AiD8FEr7mKlB8w9xx3h8WzSUb0=.sha256 + var index + if (plugin === this.sbot.backlinks) { + var c = filter && filter.value && filter.value.content + var filteringByType = c && c.type + if (!filteringByType) index = 'DTS' + } // work around flumeview-query not supporting $lt/$gt. // %FCIv0D7JQyERznC18p8Dc1KtN6SLeJAl1sR5DAIr/Ek=.sha256 return pull( plugin.read({ + index: index, reverse: opts.reverse, limit: opts.limit && (opts.limit + 1), query: [{$filter: u.mergeOpts(filter, { @@ -497,12 +506,6 @@ App.prototype.streamChannel = function (opts) { // prefer ssb-backlinks to ssb-query because it also handles hashtag mentions if (this.sbot.backlinks) return this.filter(this.sbot.backlinks, opts, { dest: '#' + opts.channel, - value: { - // filter by message type to work around %b+QdyLFQ21UGYwvV3AiD8FEr7mKlB8w9xx3h8WzSUb0=.sha256 - content: { - type: 'post' - } - } }) if (this.sbot.query) return this.filter(this.sbot.query, opts, { @@ -519,12 +522,6 @@ App.prototype.streamMentions = function (opts) { if (this.sbot.backlinks) return this.filter(this.sbot.backlinks, opts, { dest: this.sbot.id, - value: { - // filter by message type to work around %b+QdyLFQ21UGYwvV3AiD8FEr7mKlB8w9xx3h8WzSUb0=.sha256 - content: { - type: 'post' - } - } }) } -- cgit v1.2.3