Files: 8261134eb7daa7f16ad7f83ebb1549e60b37b70d / plugs / message_render / zz_fallback.js
616 bytesRaw
1 | var h = require('mutant/h') |
2 | |
3 | exports.needs = { |
4 | message_layout: 'first', |
5 | message_decorate: 'reduce' |
6 | } |
7 | |
8 | exports.gives = { |
9 | message_render: true |
10 | } |
11 | |
12 | exports.create = function (api) { |
13 | return { |
14 | message_render |
15 | } |
16 | |
17 | function message_render (msg) { |
18 | var element = api.message_layout(msg, { |
19 | content: message_content(msg), |
20 | layout: 'mini' |
21 | }) |
22 | |
23 | return api.message_decorate(element, { msg }) |
24 | } |
25 | |
26 | function message_content (msg) { |
27 | if (typeof msg.value.content === 'string') { |
28 | return h('code', {}, 'PRIVATE') |
29 | } else { |
30 | return h('code', {}, msg.value.content.type) |
31 | } |
32 | } |
33 | } |
34 |
Built with git-ssb-web