From ef2fab24f57268bc2a96e74078855dfad047fd5b Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 6 Dec 2017 16:01:59 -0800 Subject: Render npm-packages dependencyBranch, versionBranch --- lib/render-msg.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/render-msg.js b/lib/render-msg.js index e25d1b7..51db2a7 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -1062,9 +1062,23 @@ RenderMsg.prototype.npmPublish = function (cb) { RenderMsg.prototype.npmPackages = function (cb) { var self = this + var done = multicb({pluck: 1, spread: true}) + var elCb = done() + function renderIdLink(id) { + return [h('a', {href: self.toUrl(id)}, truncate(id, 8)), ' '] + } self.render.npmPackageMentions(self.c.mentions, function (err, el) { if (err) return cb(err) - self.wrap(el, cb) + self.wrap(h('div', [ + el, + Array.isArray(self.c.dependencyBranch) ? h('div', + 'dependencies via: ', self.c.dependencyBranch.map(renderIdLink) + ) : '', + Array.isArray(self.c.versionBranch) ? h('div', + 'previous versions: ', self.c.versionBranch.map(renderIdLink) + ) : '' + ]), elCb) + return done(cb) }) } -- cgit v1.2.3