aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-27 20:02:45 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-29 10:48:33 -1000
commit165b3ff15a35e91b40ccead2dbdb0c8a894dd42c (patch)
treeaa9b19620620e2274e5c3de6585e1ad22377fbc2
parent58f8201a3298ae00759f895a083a2d1f5ec561b7 (diff)
downloadpatchfoo-165b3ff15a35e91b40ccead2dbdb0c8a894dd42c.tar.gz
patchfoo-165b3ff15a35e91b40ccead2dbdb0c8a894dd42c.zip
Reply in branch channel if no root channel
-rw-r--r--lib/serve.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 7b4ee55..00c2968 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -692,12 +692,16 @@ Serve.prototype.id = function (id, ext) {
var rootContent = rootMsg && rootMsg.value && rootMsg.value.content
var recps = rootContent && rootContent.recps
var threadRootId = rootContent && rootContent.root || id
- var channel = rootContent && rootContent.channel
+ var channel
pull(
cat([pull.once(rootMsg), self.app.sbot.links({dest: id, values: true})]),
pull.unique('key'),
self.app.unboxMessages(),
+ pull.through(function (msg) {
+ var c = msg && msg.value.content
+ if (!channel && c.channel) channel = c.channel
+ }),
pull.collect(function (err, links) {
if (err) return self.respond(500, err.stack || err)
pull(