git ssb

10+

Matt McKegg / patchwork



Tree: 2150c96ae49e67fdcb638a88455af2c3ae8c9c53

Files: 2150c96ae49e67fdcb638a88455af2c3ae8c9c53 / modules / page / html / render / mentions.js

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

Built with git-ssb-web