Commit 47dda2fa1ff7e9e2cc281278bf33e79e46a38873
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=.sha256cel committed on 6/14/2017, 5:36:58 AM
Parent: 5f652a26f033d4de982ba32407455dd011a6f056
Files changed
lib/app.js | changed |
lib/app.js | |||
---|---|---|---|
@@ -472,12 +472,21 @@ | |||
472 | 472 … | ) | |
473 | 473 … | } | |
474 | 474 … | ||
475 | 475 … | App.prototype.filter = function (plugin, opts, filter) { | |
476 … | + // work around flumeview-query not picking the best index. | ||
477 … | + // %b+QdyLFQ21UGYwvV3AiD8FEr7mKlB8w9xx3h8WzSUb0=.sha256 | ||
478 … | + var index | ||
479 … | + if (plugin === this.sbot.backlinks) { | ||
480 … | + var c = filter && filter.value && filter.value.content | ||
481 … | + var filteringByType = c && c.type | ||
482 … | + if (!filteringByType) index = 'DTS' | ||
483 … | + } | ||
476 | 484 … | // work around flumeview-query not supporting $lt/$gt. | |
477 | 485 … | // %FCIv0D7JQyERznC18p8Dc1KtN6SLeJAl1sR5DAIr/Ek=.sha256 | |
478 | 486 … | return pull( | |
479 | 487 … | plugin.read({ | |
488 … | + index: index, | ||
480 | 489 … | reverse: opts.reverse, | |
481 | 490 … | limit: opts.limit && (opts.limit + 1), | |
482 | 491 … | query: [{$filter: u.mergeOpts(filter, { | |
483 | 492 … | timestamp: { | |
@@ -496,14 +505,8 @@ | |||
496 | 505 … | App.prototype.streamChannel = function (opts) { | |
497 | 506 … | // prefer ssb-backlinks to ssb-query because it also handles hashtag mentions | |
498 | 507 … | if (this.sbot.backlinks) return this.filter(this.sbot.backlinks, opts, { | |
499 | 508 … | dest: '#' + opts.channel, | |
500 | - value: { | ||
501 | - // filter by message type to work around %b+QdyLFQ21UGYwvV3AiD8FEr7mKlB8w9xx3h8WzSUb0=.sha256 | ||
502 | - content: { | ||
503 | - type: 'post' | ||
504 | - } | ||
505 | - } | ||
506 | 509 … | }) | |
507 | 510 … | ||
508 | 511 … | if (this.sbot.query) return this.filter(this.sbot.query, opts, { | |
509 | 512 … | value: {content: {channel: opts.channel}}, | |
@@ -518,14 +521,8 @@ | |||
518 | 521 … | 'Viewing mentions requires the ssb-backlinks plugin')) | |
519 | 522 … | ||
520 | 523 … | if (this.sbot.backlinks) return this.filter(this.sbot.backlinks, opts, { | |
521 | 524 … | dest: this.sbot.id, | |
522 | - value: { | ||
523 | - // filter by message type to work around %b+QdyLFQ21UGYwvV3AiD8FEr7mKlB8w9xx3h8WzSUb0=.sha256 | ||
524 | - content: { | ||
525 | - type: 'post' | ||
526 | - } | ||
527 | - } | ||
528 | 525 … | }) | |
529 | 526 … | } | |
530 | 527 … | ||
531 | 528 … | App.prototype.streamPrivate = function (opts) { |
Built with git-ssb-web