aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js46
1 files changed, 17 insertions, 29 deletions
diff --git a/lib/serve.js b/lib/serve.js
index defac87..002c520 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -583,18 +583,10 @@ Serve.prototype.contacts = function (path) {
)
}
- function idLink(id) {
- return pull(
- pull.once(id),
- pull.asyncMap(self.renderIdLink.bind(self)),
- pull.map(u.toHTML)
- )
- }
-
pull(
cat([
ph('section', {}, [
- ph('h3', {}, ['Contacts: ', idLink(id)]),
+ ph('h3', {}, ['Contacts: ', self.pullIdLink(id)]),
ph('h4', {}, 'Friends'),
renderFriendsList()(contacts.friends),
ph('h4', {}, 'Follows'),
@@ -1028,25 +1020,18 @@ Serve.prototype.wrapPage = function (title, searchQ) {
)
}
-Serve.prototype.renderIdLink = function (id, cb) {
- var render = this.app.render
- var el = render.idLink(id, function (err) {
- if (err || !el) {
- el = h('a', {href: render.toUrl(id)}, id)
- }
- cb(null, el)
- })
+Serve.prototype.pullIdLink = function (id) {
+ return pull(
+ pull.once(id),
+ this.renderIdsList()
+ )
}
Serve.prototype.friends = function (path) {
var self = this
pull(
self.app.sbot.friends.createFriendStream({hops: 1}),
- self.renderFriends(),
- pull.map(function (el) {
- return [el, ' ']
- }),
- pull.map(u.toHTML),
+ self.renderIdsList(),
u.hyperwrap(function (items, cb) {
cb(null, [
h('section',
@@ -1062,14 +1047,17 @@ Serve.prototype.friends = function (path) {
)
}
-Serve.prototype.renderFriends = function () {
+Serve.prototype.renderIdsList = function () {
var self = this
- return paramap(function (id, cb) {
- self.renderIdLink(id, function (err, el) {
- if (err) el = u.renderError(err, ext)
- cb(null, el)
- })
- }, 8)
+ return pull(
+ paramap(function (id, cb) {
+ self.app.render.getNameLink(id, cb)
+ }, 8),
+ pull.map(function (el) {
+ return [el, ' ']
+ }),
+ pull.map(u.toHTML)
+ )
}
var relationships = [