aboutsummaryrefslogtreecommitdiff
path: root/lib/app.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-12 17:53:27 -0700
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-12 18:51:16 -0700
commita755d08d1cdfde6a9a48de38d8fdd779148709b8 (patch)
tree0ff0ffdc48fac7c82ea2b82471325a2074a802d5 /lib/app.js
parent84e5ab8d6281beeeadb18d7c411157498638749a (diff)
downloadpatchfoo-a755d08d1cdfde6a9a48de38d8fdd779148709b8.tar.gz
patchfoo-a755d08d1cdfde6a9a48de38d8fdd779148709b8.zip
Add (un)follow button
Diffstat (limited to 'lib/app.js')
-rw-r--r--lib/app.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/app.js b/lib/app.js
index 6cc71a0..465e45b 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -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(