aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-01-31 15:23:44 -0800
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-01-31 15:27:12 -0800
commit1d8da956931ce0b6a4906033afe406603fe98c53 (patch)
treeb7f35d6bad7ca71c0be999aa5836beab5a4c3577
parenta7040f725b3aef80e717673511556e170d989dd9 (diff)
downloadpatchfoo-1d8da956931ce0b6a4906033afe406603fe98c53.tar.gz
patchfoo-1d8da956931ce0b6a4906033afe406603fe98c53.zip
Show issues closed by messages
-rw-r--r--lib/render-msg.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index bc0d383..a9b783f 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -55,6 +55,7 @@ RenderMsg.prototype.wrap = function (content, cb) {
h('code.ssb-id',
{href: this.toUrl(this.msg.key)}, this.msg.key),
channel ? [' ', h('a', {href: this.toUrl(channel)}, channel)] : ''),
+ this.issues(done()),
content),
h('td.msg-right',
this.msg.rel ? [this.msg.rel, ' '] : '',
@@ -220,6 +221,19 @@ RenderMsg.prototype.link = function (link, cb) {
})
}
+RenderMsg.prototype.link1 = function (link, cb) {
+ var self = this
+ var ref = u.linkDest(link)
+ if (!ref) return cb(), ''
+ var a = h('a', {href: self.toUrl(ref)}, ref)
+ self.getName(ref, function (err, name) {
+ if (err) return cb(err)
+ a.childNodes[0].textContent = name
+ cb()
+ })
+ return a
+}
+
RenderMsg.prototype.about = function (cb) {
var img = u.linkDest(this.c.image)
this.wrapMini([
@@ -335,3 +349,23 @@ RenderMsg.prototype.issue = function (cb) {
RenderMsg.prototype.object = function (cb) {
this.wrapMini(h('pre', this.c.type), cb)
}
+
+RenderMsg.prototype.issues = function (cb) {
+ var self = this
+ var done = multicb({pluck: 1, spread: true})
+ var els = u.toArray(self.c.issues).map(function (issue) {
+ var commit = issue.object || issue.label ? [
+ issue.object ? h('code', issue.object) : '', ' ',
+ issue.label ? h('q', issue.label) : ''] : ''
+ if (issue.merged === true)
+ return h('div',
+ 'merged ', self.link1(issue, done()),
+ commit ? [' in ', commit] : '')
+ if (issue.open === false)
+ return h('div',
+ 'closed ', self.link1(issue, done()),
+ commit ? [' in ', commit] : '')
+ })
+ done(cb)
+ return els
+}