aboutsummaryrefslogtreecommitdiff
path: root/lib/render-msg.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r--lib/render-msg.js23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index a1b62e4..c1dd38b 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -439,14 +439,31 @@ RenderMsg.prototype.post = function (cb) {
var done = multicb({pluck: 1, spread: true})
if (self.c.root === self.c.branch) done()()
else self.link(self.c.root, done())
- self.links(self.c.branch, done())
+ var branches = u.toArray(self.c.branch)
+ self.links(branches, done())
self.links(self.c.fork, done())
- done(function (err, rootLink, branchLinks, forkLinks) {
+ var replyIById = {}
+ if (self.c.reply) {
+ var replyFeeds = []
+ for (var k in self.c.reply) {
+ replyIById[k] = replyFeeds.push(self.c.reply[k])-1
+ }
+ self.links(replyFeeds, done())
+ } else done()()
+ done(function (err, rootLink, branchLinks, forkLinks, replyLinks) {
if (err) return self.wrap(u.renderError(err), cb)
self.wrap(h('div.ssb-post',
rootLink ? h('div', h('small', h('span.symbol', '→'), ' ', rootLink)) : '',
branchLinks.map(function (a, i) {
- return h('div', h('small', h('span.symbol', '  ↳'), ' ', a))
+ var replyLink
+ if (self.c.reply) {
+ var branchId = branches[i]
+ var replyI = replyIById[branchId]
+ replyLink = replyLinks[replyI]
+ }
+ return h('div', h('small', h('span.symbol', '  ↳'), ' ',
+ replyLink ? [replyLink, ' '] : '',
+ a))
}),
forkLinks.map(function (a, i) {
return h('div', h('small', h('span.symbol', '⑂'), ' ', a))