aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-08-21 13:57:52 -0700
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-08-21 15:43:56 -0700
commit369f72529e83414099bdf037c3015cc9f61a038d (patch)
tree39a88f07dd3585c50c91c8f6fa437f78dc5ed735
parent6f40e2afcea954c4adc8feb206aaf1ebc76c05ba (diff)
downloadpatchfoo-369f72529e83414099bdf037c3015cc9f61a038d.tar.gz
patchfoo-369f72529e83414099bdf037c3015cc9f61a038d.zip
Improve setting thread root & branches for replies
Detect thread root of ssb-web and talenet messages
-rw-r--r--lib/serve.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/serve.js b/lib/serve.js
index f8dcf65..75e84e6 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -1061,7 +1061,10 @@ Serve.prototype.channel = function (path) {
function threadHeads(msgs, rootId) {
return sort.heads(msgs.filter(function (msg) {
var c = msg.value && msg.value.content
- return (c && c.root === rootId)
+ return (c && (
+ c.type === 'web-root' ? c.site === rootId :
+ c.type === 'talenet-idea-comment_reply' ? c.ideaKey === rootId :
+ c.root === rootId))
|| msg.key === rootId
}))
}
@@ -1083,7 +1086,9 @@ Serve.prototype.streamThreadWithComposer = function (opts) {
|| ((rootMsg.value.private || typeof rootMsg.value.content === 'string')
? [rootMsg.value.author, self.app.sbot.id].filter(uniques())
: undefined)
- var threadRootId = rootContent && rootContent.root || id
+ var threadRootId = rootContent && (
+ rootContent.type === 'web-root' ? rootContent.site : rootContent.root
+ ) || id
var channel = opts.channel
pull(