diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-04-12 17:53:27 -0700 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-04-12 18:51:16 -0700 |
commit | a755d08d1cdfde6a9a48de38d8fdd779148709b8 (patch) | |
tree | 0ff0ffdc48fac7c82ea2b82471325a2074a802d5 /lib/app.js | |
parent | 84e5ab8d6281beeeadb18d7c411157498638749a (diff) | |
download | patchfoo-a755d08d1cdfde6a9a48de38d8fdd779148709b8.tar.gz patchfoo-a755d08d1cdfde6a9a48de38d8fdd779148709b8.zip |
Add (un)follow button
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -201,6 +201,21 @@ App.prototype.streamPeers = function (opts) { }) } +App.prototype.getFollow = function (source, dest, cb) { + var self = this + pull( + self.sbot.links({source: source, dest: dest, rel: 'contact', values: true}), + pull.filter(function (msg) { + var c = msg && msg.value && msg.value.content + return c && c.type === 'contact' + }), + pull.reduce(function (doesFollow, msg) { + var c = msg.value.content + return !!c.following + }, false, cb) + ) +} + App.prototype.getFollows = function (id, cb) { var self = this pull( |