aboutsummaryrefslogtreecommitdiff
path: root/lib/app.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-11-10 07:56:13 +1300
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-11-10 07:56:13 +1300
commitc7b4eb97124284b5c2f9d27a78fbcd83abf3d88a (patch)
tree42e42fcadede049d791937022a14ac0d60a85eba /lib/app.js
parent74da815bd5764df91b69af7e636b34ba7782f2e0 (diff)
downloadpatchfoo-c7b4eb97124284b5c2f9d27a78fbcd83abf3d88a.tar.gz
patchfoo-c7b4eb97124284b5c2f9d27a78fbcd83abf3d88a.zip
Add block button
Diffstat (limited to 'lib/app.js')
-rw-r--r--lib/app.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/app.js b/lib/app.js
index c2beb69..0adf59a 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -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)
)
}