From 631791d5345cbc1c29fc844d5785139dff746958 Mon Sep 17 00:00:00 2001 From: cel Date: Mon, 12 Jun 2017 13:55:42 -1000 Subject: Add mentions page using ssb-backlinks --- lib/app.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/app.js') diff --git a/lib/app.js b/lib/app.js index 6e182bf..3ff8b81 100644 --- a/lib/app.js +++ b/lib/app.js @@ -501,3 +501,23 @@ App.prototype.streamChannel = function (opts) { return pull.error(new Error( 'Viewing channels/tags requires the ssb-backlinks or ssb-query plugin')) } + +App.prototype.streamMentions = function (opts) { + if (!this.sbot.backlinks) return pull.error(new Error( + 'Viewing mentions requires the ssb-backlinks plugin')) + + if (this.sbot.backlinks) return this.sbot.backlinks.read(u.mergeOpts(opts, { + query: [{$filter: { + dest: this.sbot.id, + value: { + content: { + type: 'post' + } + }, + timestamp: { + $gt: opts.gt, + $lt: opts.lt, + } + }}] + })) +} -- cgit v1.2.3