git ssb

3+

dangerousbeans / scuttle-vue



Tree: 8dc25143a3f37f1618f7a92b3c46dec512b43bfd

Files: 8dc25143a3f37f1618f7a92b3c46dec512b43bfd / modules / about.js

858 bytesRaw
1var h = require('hyperscript')
2var ref = require('ssb-ref')
3
4function idLink (id) {
5 if (ref.isLink(id)) {
6 return h('a', {href:'#'+id}, id.substring(0, 10)+'...')
7 }
8}
9
10exports.needs = {
11 blob_url: 'first'
12}
13
14exports.gives = 'message_content'
15
16exports.create = function (api) {
17 return function (msg) {
18 if(msg.value.content.type !== 'about') return
19
20 if(!msg.value.content.image && !msg.value.content.name)
21 return
22
23 var about = msg.value.content
24 var id = msg.value.content.about
25 return h('p',
26 about.about === msg.value.author
27 ? h('span', 'self-identifies ')
28 : h('span', 'identifies ', idLink(id)),
29 ' as ',
30 h('a', {href:"#"+about.about},
31 about.name || null,
32 about.image
33 ? h('img.avatar--thumbnail', {src: api.blob_url(about.image)})
34 : null
35 )
36 )
37 }
38}
39

Built with git-ssb-web