diff options
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -395,20 +395,21 @@ App.prototype.streamPeers = function (opts) { }) } -App.prototype.getFollow = function (source, dest, cb) { +App.prototype.getContact = function (source, dest, cb) { var self = this pull( - self.sbot.links({source: source, dest: dest, rel: 'contact', reverse: true, + self.sbot.links({source: source, dest: dest, rel: 'contact', values: true, meta: false, keys: false}), pull.filter(function (value) { var c = value && value.content return c && c.type === 'contact' }), - pull.take(1), - pull.collect(function (err, msgs) { - if (err) return cb(err) - cb(null, msgs[0] && !!msgs[0].content.following) - }) + pull.reduce(function (acc, value) { + // trinary logic from ssb-friends + return value.content.following ? true + : value.content.flagged || value.content.blocking ? false + : acc + }, null, cb) ) } |