aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519>2020-05-09 12:13:39 -0400
committercel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519>2020-05-09 12:13:39 -0400
commit626f5b402618c82bf36ba36321b00956dfb5b2ba (patch)
treeeda1da10a368cdb61091191abed20322ad174da5 /lib
parent0e96112c494abb83e8cd9696a4ca08a09d4fb2ef (diff)
downloadpatchfoo-626f5b402618c82bf36ba36321b00956dfb5b2ba.tar.gz
patchfoo-626f5b402618c82bf36ba36321b00956dfb5b2ba.zip
Render post reply feed ids alongside branch links
Diffstat (limited to 'lib')
-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))