git ssb

10+

Matt McKegg / patchwork



Tree: ec22930fce654eefee73dc9cc02061810988d4bd

Files: ec22930fce654eefee73dc9cc02061810988d4bd / 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