aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js59
1 files changed, 23 insertions, 36 deletions
diff --git a/lib/serve.js b/lib/serve.js
index e05acd5..47bc7c2 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -797,10 +797,10 @@ Serve.prototype.channels = function (ext) {
Serve.prototype.contacts = function (path) {
var self = this
var id = String(path).substr(1)
+ var contacts = self.app.createContactStreams(id)
- function renderFriendsList(ids) {
+ function renderFriendsList() {
return pull(
- pull.values(ids),
paramap(function (id, cb) {
self.app.getAbout(id, function (err, about) {
var name = about && about.name || id.substr(0, 8) + '…'
@@ -815,40 +815,27 @@ Serve.prototype.contacts = function (path) {
)
}
- self.app.getContacts(id, function (err, contacts) {
- if (err) return self.respond(500, err.stack || err)
- pull(
- cat([
- ph('section', {}, [
- ph('h3', {}, ['Contacts: ', self.phIdLink(id)]),
- contacts.friends.length ? [
- ph('h4', {}, 'Friends'),
- renderFriendsList(contacts.friends),
- ] : [],
- contacts.follows.length ? [
- ph('h4', {}, 'Follows'),
- renderFriendsList(contacts.follows),
- ] : [],
- contacts.followers.length ? [
- ph('h4', {}, 'Followers'),
- renderFriendsList(contacts.followers),
- ] : [],
- contacts.blocks.length ? [
- ph('h4', {}, 'Blocks'),
- renderFriendsList(contacts.blocks),
- ] : [],
- contacts.blockers.length ? [
- ph('h4', {}, 'Blocked by'),
- renderFriendsList(contacts.blockers),
- ] : [],
- ])
- ]),
- self.wrapPage('contacts: ' + id),
- self.respondSink(200, {
- 'Content-Type': ctype('html')
- })
- )
- })
+ pull(
+ cat([
+ ph('section', {}, [
+ ph('h3', {}, ['Contacts: ', self.phIdLink(id)]),
+ ph('h4', {}, 'Friends'),
+ renderFriendsList()(contacts.friends),
+ ph('h4', {}, 'Follows'),
+ renderFriendsList()(contacts.follows),
+ ph('h4', {}, 'Followers'),
+ renderFriendsList()(contacts.followers),
+ ph('h4', {}, 'Blocks'),
+ renderFriendsList()(contacts.blocks),
+ ph('h4', {}, 'Blocked by'),
+ renderFriendsList()(contacts.blockers)
+ ])
+ ]),
+ this.wrapPage('contacts: ' + id),
+ this.respondSink(200, {
+ 'Content-Type': ctype('html')
+ })
+ )
}
Serve.prototype.about = function (path) {