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