Files: 4d1aa8528ed9342d5d663af75cb08beb82f0fbcc / message / html / render / issue.js
798 bytesRaw
1 | var h = require('mutant/h') |
2 | var nest = require('depnest') |
3 | var extend = require('xtend') |
4 | |
5 | exports.needs = nest({ |
6 | 'message.html': { |
7 | decorate: 'reduce', |
8 | layout: 'first', |
9 | link: 'first', |
10 | markdown: 'first' |
11 | } |
12 | }) |
13 | |
14 | exports.gives = nest('message.html.render') |
15 | |
16 | exports.create = function (api) { |
17 | return nest('message.html.render', function renderMessage (msg, opts) { |
18 | if (msg.value.content.type !== 'issue') return |
19 | var element = api.message.html.layout(msg, extend({ |
20 | content: messageContent(msg), |
21 | layout: 'default' |
22 | }, opts)) |
23 | |
24 | return api.message.html.decorate(element, { msg }) |
25 | }) |
26 | |
27 | function messageContent (data) { |
28 | if (!data.value.content || !data.value.content.text) return |
29 | return h('div', {}, api.message.html.markdown(data.value.content)) |
30 | } |
31 | } |
32 |
Built with git-ssb-web