diff options
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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) + }) ) } |