aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/app.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/app.js b/lib/app.js
index 8a74dbb..b57e5a6 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -250,15 +250,17 @@ App.prototype.streamPeers = function (opts) {
App.prototype.getFollow = function (source, dest, cb) {
var self = this
pull(
- self.sbot.links({source: source, dest: dest, rel: 'contact', values: true}),
- pull.filter(function (msg) {
- var c = msg && msg.value && msg.value.content
+ self.sbot.links({source: source, dest: dest, rel: 'contact', reverse: true,
+ values: true, meta: false, keys: false}),
+ pull.filter(function (value) {
+ var c = value && value.content
return c && c.type === 'contact'
}),
- pull.reduce(function (doesFollow, msg) {
- var c = msg.value.content
- return !!c.following
- }, false, cb)
+ pull.take(1),
+ pull.collect(function (err, msgs) {
+ if (err) return cb(err)
+ cb(null, msgs[0] && !!msgs[0].content.following)
+ })
)
}