aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-06-12 13:55:42 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-06-12 14:04:08 -1000
commit631791d5345cbc1c29fc844d5785139dff746958 (patch)
tree7589eb83b0314ad4b0afb78affe771aa3fb7b07c /lib/serve.js
parent0fec67a93d8af9fa888051aa3c087d50d80cb079 (diff)
downloadpatchfoo-631791d5345cbc1c29fc844d5785139dff746958.tar.gz
patchfoo-631791d5345cbc1c29fc844d5785139dff746958.zip
Add mentions page using ssb-backlinks
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 2d088ae..3e20a0f 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -276,6 +276,7 @@ Serve.prototype.path = function (url) {
case '/new': return this.new(m[2])
case '/public': return this.public(m[2])
case '/private': return this.private(m[2])
+ case '/mentions': return this.mentions(m[2])
case '/search': return this.search(m[2])
case '/advsearch': return this.advsearch(m[2])
case '/vote': return this.vote(m[2])
@@ -411,6 +412,32 @@ Serve.prototype.private = function (ext) {
)
}
+Serve.prototype.mentions = function (ext) {
+ var self = this
+ var q = self.query
+ var opts = {
+ reverse: !q.forwards,
+ sortByTimestamp: q.sort === 'claimed',
+ lt: Number(q.lt) || Date.now(),
+ gt: Number(q.gt) || -Infinity,
+ limit: Number(q.limit) || 12,
+ }
+
+ return pull(
+ ph('section', {}, [
+ ph('h3', 'Mentions'),
+ pull(
+ self.app.streamMentions(opts),
+ self.app.unboxMessages(),
+ self.renderThreadPaginated(opts, null, q),
+ self.wrapMessages()
+ )
+ ]),
+ self.wrapPage('mentions'),
+ self.respondSink(200)
+ )
+}
+
Serve.prototype.search = function (ext) {
var searchQ = (this.query.q || '').trim()
var self = this
@@ -1263,6 +1290,7 @@ Serve.prototype.wrapPage = function (title, searchQ) {
h('a', {href: render.toUrl('/new')}, 'new') , ' ',
h('a', {href: render.toUrl('/public')}, 'public'), ' ',
h('a', {href: render.toUrl('/private')}, 'private') , ' ',
+ h('a', {href: render.toUrl('/mentions')}, 'mentions') , ' ',
h('a', {href: render.toUrl('/peers')}, 'peers') , ' ',
h('a', {href: render.toUrl('/channels')}, 'channels') , ' ',
h('a', {href: render.toUrl('/friends')}, 'friends'), ' ',