Commit 931ac024cad9b0e63311dd1a76de77d0490f8391
Render pub messages
cel committed on 11/29/2016, 4:25:04 PMParent: e7fc925105dd9b5a36e85af534af3db99b13faed
Files changed
modules_basic/index.js | changed |
modules_basic/pub.js | added |
modules_basic/index.js | ||
---|---|---|
@@ -17,8 +17,9 @@ | ||
17 | 17 … | "message.js": require('./message.js'), |
18 | 18 … | "names.js": require('./names.js'), |
19 | 19 … | "post.js": require('./post.js'), |
20 | 20 … | "private.js": require('./private.js'), |
21 … | + "pub.js": require('./pub.js'), | |
21 | 22 … | "public.js": require('./public.js'), |
22 | 23 … | "relationships.js": require('./relationships.js'), |
23 | 24 … | "search-box.js": require('./search-box.js'), |
24 | 25 … | "setup.js": require('./setup'), |
modules_basic/pub.js | ||
---|---|---|
@@ -1,0 +1,18 @@ | ||
1 … | +var h = require('hyperscript') | |
2 … | +var plugs = require('../plugs') | |
3 … | +var avatar_name = plugs.first(exports.avatar_name = []) | |
4 … | +var avatar_link = plugs.first(exports.avatar_link = []) | |
5 … | + | |
6 … | +exports.message_content = function (msg, sbot) { | |
7 … | + var c = msg.value.content | |
8 … | + if (c.type === 'pub') { | |
9 … | + var address = c.address || {} | |
10 … | + return [ | |
11 … | + h('p', 'announced an address for ', | |
12 … | + avatar_link(address.key, avatar_name(address.key)), ':'), | |
13 … | + h('blockquote', | |
14 … | + h('code', address.host + ':' + address.port) | |
15 … | + ) | |
16 … | + ] | |
17 … | + } | |
18 … | +} |
Built with git-ssb-web