From 369f72529e83414099bdf037c3015cc9f61a038d Mon Sep 17 00:00:00 2001 From: cel Date: Tue, 21 Aug 2018 13:57:52 -0700 Subject: Improve setting thread root & branches for replies Detect thread root of ssb-web and talenet messages --- lib/serve.js | 9 +++++++-- 1 file 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( -- cgit v1.2.3