Commit 6a04c1500ae5d062c3a688cf9677d5229a8ca9b1
Handle messages with >1 branch
Charles Lehner committed on 7/11/2016, 6:38:22 AMParent: e255333d2b8e29f0eb913728c567b6d707c424bd
Files changed
modules/notifications.js | changed |
modules/notifications.js | ||
---|---|---|
@@ -3,8 +3,9 @@ | ||
3 | 3 | var pull = require('pull-stream') |
4 | 4 | var Scroller = require('pull-scroll') |
5 | 5 | var paramap = require('pull-paramap') |
6 | 6 | var plugs = require('../plugs') |
7 | +var cont = require('cont') | |
7 | 8 | |
8 | 9 | var message_render = plugs.first(exports.message_render = []) |
9 | 10 | var sbot_log = plugs.first(exports.sbot_log = []) |
10 | 11 | var sbot_whoami = plugs.first(exports.sbot_whoami = []) |
@@ -48,17 +49,16 @@ | ||
48 | 49 | return cb(null, msg) |
49 | 50 | |
50 | 51 | switch (c.type) { |
51 | 52 | case 'post': |
52 | - if (c.branch) | |
53 | - return isOurMsg(c.branch, function (err, isOurs) { | |
53 | + if (c.branch || c.root) | |
54 | + cont.para([].concat(c.branch, c.root).map(function (id) { | |
55 | + return function (cb) { isOurMsg(id, cb) } | |
56 | + })) | |
57 | + (function (err, results) { | |
54 | 58 | if (err) cb(err) |
55 | - else if (isOurs) cb(null, msg) | |
56 | - else if (c.root) isOurMsg(c.root, function (err, isOurs) { | |
57 | - if (err) cb(err) | |
58 | - else if (isOurs) cb(null, msg) | |
59 | - else cb() | |
60 | - }) | |
59 | + else if (results.some(Boolean)) cb(null, msg) | |
60 | + else cb() | |
61 | 61 | }) |
62 | 62 | else return cb() |
63 | 63 | |
64 | 64 | case 'contact': |
Built with git-ssb-web