From 8804ea0353ffbfb5bc6fa82031d8eadfad6ce41a Mon Sep 17 00:00:00 2001 From: cel Date: Mon, 13 Mar 2017 11:22:18 -0400 Subject: link to post root and branch messages --- lib/render-msg.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/render-msg.js') diff --git a/lib/render-msg.js b/lib/render-msg.js index 09eb3e2..23e236f 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -220,10 +220,21 @@ RenderMsg.prototype.markdown = function (cb) { RenderMsg.prototype.post = function (cb) { var self = this - self.link(self.c.root, function (err, a) { + var done = multicb({pluck: 1, spread: true}) + var branchDone = multicb({pluck: 1}) + u.toArray(self.c.branch).forEach(function (branch) { + self.link(branch, branchDone()) + }) + if (self.c.root === self.c.branch) done()() + else self.link(self.c.root, done()) + branchDone(done()) + done(function (err, rootLink, branchLinks) { if (err) return self.wrap(u.renderError(err), cb) self.wrap(h('div.ssb-post', - a ? h('div', h('small', 're: ', a)) : '', + rootLink ? h('div', h('small', '>> ', rootLink)) : '', + branchLinks.map(function (a, i) { + return h('div', h('small', '> ', a)) + }), h('div.ssb-post-text', {innerHTML: self.markdown()}) ), cb) }) -- cgit v1.2.3