git ssb

10+

Matt McKegg / patchwork



Tree: 7f0e32707cd24ca1c8721a7b8a6028e13958630e

Files: 7f0e32707cd24ca1c8721a7b8a6028e13958630e / modules / page / html / render / mentions.js

822 bytesRaw
1var nest = require('depnest')
2
3exports.needs = nest({
4 'feed.html.rollup': 'first',
5 'keys.sync.id': 'first',
6 'feed.pull.mentions': 'first'
7})
8
9exports.gives = nest('page.html.render')
10
11exports.create = function (api) {
12 return nest('page.html.render', function mentions (path) {
13 if (path !== '/mentions') return
14 var id = api.keys.sync.id()
15 return api.feed.html.rollup(api.feed.pull.mentions(id), {
16 bumpFilter: mentionFilter,
17 displayFilter: mentionFilter
18 })
19
20 // scoped
21 function mentionFilter (msg) {
22 if (Array.isArray(msg.value.content.mentions) && msg.value.content.mentions.some(mention => {
23 return mention && mention.link === id
24 })) {
25 return 'mention'
26 } else if (msg.value.content.type === 'contact') {
27 return true
28 }
29 }
30 })
31}
32

Built with git-ssb-web