aboutsummaryrefslogtreecommitdiff
path: root/lib/app.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-01-28 23:30:51 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-01-29 00:20:15 -1000
commitb705fe62e350ac3087feb811b0390c7fd2f9a20f (patch)
treebd425a924efe2764d0f1d6bfcabe19cc20bd73aa /lib/app.js
parent304dc21333457363ea79c035ce9115d48ecc9855 (diff)
downloadpatchfoo-b705fe62e350ac3087feb811b0390c7fd2f9a20f.tar.gz
patchfoo-b705fe62e350ac3087feb811b0390c7fd2f9a20f.zip
Move pub addresses out of profile page
Diffstat (limited to 'lib/app.js')
-rw-r--r--lib/app.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/app.js b/lib/app.js
index 3b56da7..bac3d53 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -977,6 +977,46 @@ App.prototype.getAddresses = function (id) {
)
}
+App.prototype.isPub = function (id, cb) {
+ if (!this.sbot.backlinks) {
+ return pull(
+ this.sbot.links({
+ dest: id,
+ rel: 'pub'
+ }),
+ pull.take(1),
+ pull.collect(function (err, links) {
+ if (err) return cb(err)
+ cb(null, links.length == 1)
+ })
+ )
+ }
+ return pull(
+ this.sbot.backlinks.read({
+ limit: 1,
+ query: [
+ {$filter: {
+ dest: id,
+ value: {
+ content: {
+ type: 'pub',
+ address: {
+ key: id,
+ host: {$truthy: true},
+ port: {$truthy: true},
+ }
+ }
+ }
+ }}
+ ]
+ }),
+ pull.collect(function (err, msgs) {
+ if (err) return cb(err)
+ cb(null, msgs.length == 1)
+ })
+ )
+}
+
App.prototype.getIdeaTitle = function (id, cb) {
if (!this.sbot.backlinks) return cb(null, String(id).substr(0, 8) + '…')
pull(