git ssb

0+

dangerousbeans / yap



forked from Dominic / yap

Tree: 8c686fb2b73c28246604759c61d6636e2812d871

Files: 8c686fb2b73c28246604759c61d6636e2812d871 / apis / message-link.js

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

Built with git-ssb-web