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