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