git ssb

16+

Dominic / patchbay



Tree: fb6ed3fc5d2e702c2a92d6962ab9649fc3cf9be2

Files: fb6ed3fc5d2e702c2a92d6962ab9649fc3cf9be2 / modules / message-link.js

547 bytesRaw
1var h = require('hyperscript')
2var ref = require('ssb-ref')
3
4var first = require('../plugs').first
5var sbot_get = first(exports.sbot_get = [])
6var message_name = first(exports.message_name = [])
7
8exports.message_link = function (id) {
9
10 if('string' !== typeof id)
11 throw new Error('link must be to message id')
12
13 var link = h('a', {href: '#'+id}, id.substring(0, 10)+'...')
14
15 if(ref.isMsg(id))
16 message_name(id, function (err, name) {
17 if(err) console.error(err)
18 else link.textContent = name
19 })
20
21 return link
22}
23
24
25
26
27
28
29
30
31
32
33
34

Built with git-ssb-web