git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Tree: b2886f60b5b31141643c0ea134c62b9e8e0db8e2

Files: b2886f60b5b31141643c0ea134c62b9e8e0db8e2 / modules / git-mini-messages.js

669 bytesRaw
1var h = require('../lib/h')
2var when = require('@mmckegg/mutant/when')
3var plugs = require('patchbay/plugs')
4var message_link = plugs.first(exports.message_link = [])
5
6exports.message_content = exports.message_content_mini = function (msg, sbot) {
7 if (msg.value.content.type === 'git-update') {
8 var commits = msg.value.content.commits || []
9 return [
10 h('a', {href: `#${msg.key}`}, [
11 'pushed',
12 when(commits, [' ', pluralizeCommits(commits)])
13 ]),
14 ' to ',
15 message_link(msg.value.content.repo)
16 ]
17 }
18}
19
20function pluralizeCommits (commits) {
21 return when(commits.length === 1, '1 commit', `${commits.length} commits`)
22}
23

Built with git-ssb-web