aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-12-20 16:11:57 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-12-20 16:12:11 -1000
commit33757c47cd4bbcda6e38cbd0cc8a70c5c0b19b44 (patch)
tree7db0898532ec0ccebb96d12071209eabb7167b88
parent13a679793e88e66d13fa7d8512201c70c15154a8 (diff)
downloadpatchfoo-33757c47cd4bbcda6e38cbd0cc8a70c5c0b19b44.tar.gz
patchfoo-33757c47cd4bbcda6e38cbd0cc8a70c5c0b19b44.zip
Fix pairwise contact calculation
-rw-r--r--lib/app.js5
1 files 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)
)
}