diff options
-rw-r--r-- | lib/serve.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/serve.js b/lib/serve.js index 9809696..30bcf68 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -352,7 +352,8 @@ Serve.prototype.channel = function (channel) { function threadHeads(msgs, rootId) { return sort.heads(msgs.filter(function (msg) { - return msg.value.content.root === rootId + var c = msg.value.content + return (c && c.root === rootId) || msg.key === rootId })) } @@ -363,10 +364,11 @@ Serve.prototype.id = function (id, ext) { if (self.query.raw != null) return self.rawId(id) this.app.getMsgDecrypted(id, function (err, rootMsg) { + var rootContent = rootMsg && rootMsg.value.content var getRoot = err ? pull.error(err) : pull.once(rootMsg) - var recps = rootMsg && rootMsg.value.content.recps - var threadRootId = rootMsg && rootMsg.value.content.root || id - var channel = rootMsg && rootMsg.value.content.channel + var recps = rootContent && rootContent.recps + var threadRootId = rootContent && rootContent.root || id + var channel = rootContent && rootContent.channel pull( cat([getRoot, self.app.sbot.links({dest: id, values: true})]), |