git ssb

0+

Dominic / yap-patch



Tree: 634a3e47dc6133cc55dae03d47dc86880af6282c

Files: 634a3e47dc6133cc55dae03d47dc86880af6282c / post-name.js

614 bytesRaw
1var msum = require('markdown-summary')
2
3
4
5module.exports = function (sbot) {
6 return function (data, apply) {
7
8 function link (data) {
9 return ['a',
10 {href: apply.toUrl('message', {id: data.key})},
11 data.value.content.text ? msum.title(data.value.content.text) : data.key
12 ]
13 }
14
15 if(data.key && data.value && data.value.content && data.value.content.type)
16 return link(data)
17 else if(data.id)
18 return function (cb) {
19 sbot.get(data, function (err, msg) {
20 var _data = {key: data.id, value: msg}
21 cb(null, link(data))
22 })
23 }
24 }
25}
26

Built with git-ssb-web