Permalink
Browse files

contacts: shortcut to get values of isFollowing and isBlocking

for when contacts index is behind
  • Loading branch information...
mmckegg committed Dec 24, 2018
1 parent 415b01b commit d3bfb195f97780213534a2e9aa7b07a651d57b5f
Showing with 18 additions and 10 deletions.
  1. +18 −10 sbot/contacts.js
@@ -54,19 +54,27 @@ exports.init = function (ssb, config) {
raw: view,

isFollowing: function ({ source, dest }, cb) {
view.get((err, graph) => {
if (err) return cb(err)
var following = graph && graph[source] && graph[source][dest] === true
cb(null, following)
})
if (values && values[source]) {
cb(null, values[source][dest] === true)
} else {
view.get((err, graph) => {
if (err) return cb(err)
var following = graph && graph[source] && graph[source][dest] === true
cb(null, following)
})
}
},

isBlocking: function ({ source, dest }, cb) {
view.get((err, graph) => {
if (err) return cb(err)
var blocking = graph && graph[source] && graph[source][dest] === false
cb(null, blocking)
})
if (values && values[source]) {
cb(null, values[source][dest] === false)
} else {
view.get((err, graph) => {
if (err) return cb(err)
var blocking = graph && graph[source] && graph[source][dest] === false
cb(null, blocking)
})
}
},

/// return a list of everyone you have blocked privately

0 comments on commit d3bfb19

Please sign in to comment.