From 33757c47cd4bbcda6e38cbd0cc8a70c5c0b19b44 Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 20 Dec 2017 16:11:57 -1000 Subject: Fix pairwise contact calculation --- lib/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/app.js b/lib/app.js index fc395a2..22e1e0e 100644 --- a/lib/app.js +++ b/lib/app.js @@ -399,17 +399,18 @@ App.prototype.streamPeers = function (opts) { App.prototype.getContact = function (source, dest, cb) { var self = this pull( - self.sbot.links({source: source, dest: dest, rel: 'contact', + 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.take(1), pull.reduce(function (acc, value) { // trinary logic from ssb-friends return value.content.following ? true : value.content.flagged || value.content.blocking ? false - : acc + : null }, null, cb) ) } -- cgit v1.2.3