diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-01-28 23:30:51 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-01-29 00:20:15 -1000 |
commit | b705fe62e350ac3087feb811b0390c7fd2f9a20f (patch) | |
tree | bd425a924efe2764d0f1d6bfcabe19cc20bd73aa /lib/app.js | |
parent | 304dc21333457363ea79c035ce9115d48ecc9855 (diff) | |
download | patchfoo-b705fe62e350ac3087feb811b0390c7fd2f9a20f.tar.gz patchfoo-b705fe62e350ac3087feb811b0390c7fd2f9a20f.zip |
Move pub addresses out of profile page
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -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( |