diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-11-10 07:56:13 +1300 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-11-10 07:56:13 +1300 |
commit | c7b4eb97124284b5c2f9d27a78fbcd83abf3d88a (patch) | |
tree | 42e42fcadede049d791937022a14ac0d60a85eba /lib/app.js | |
parent | 74da815bd5764df91b69af7e636b34ba7782f2e0 (diff) | |
download | patchfoo-c7b4eb97124284b5c2f9d27a78fbcd83abf3d88a.tar.gz patchfoo-c7b4eb97124284b5c2f9d27a78fbcd83abf3d88a.zip |
Add block button
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) ) } |