From 84e5ab8d6281beeeadb18d7c411157498638749a Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 12 Apr 2017 18:03:56 -0700 Subject: Only show friends list on non-scrolled/paged feed It takes up a lot of space. Leave room for the feed content --- lib/serve.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'lib/serve.js') diff --git a/lib/serve.js b/lib/serve.js index b394f39..ec63b59 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -551,6 +551,7 @@ Serve.prototype.userFeed = function (id, ext) { gt: Number(q.gt) || -Infinity, limit: Number(q.limit) || 20 } + var isScrolled = q.lt || q.gt self.app.getAbout(id, function (err, about) { if (err) self.app.error(err) @@ -558,7 +559,7 @@ Serve.prototype.userFeed = function (id, ext) { self.app.sbot.createUserStream(opts), self.renderThreadPaginated(opts, id, q), self.wrapMessages(), - self.wrapUserFeed(id), + self.wrapUserFeed(isScrolled, id), self.wrapPage(about.name || id), self.respondSink(200, { 'Content-Type': ctype(ext) @@ -826,12 +827,12 @@ Serve.prototype.friendList = function (friends, cb) { return list } -Serve.prototype.wrapUserFeed = function (id) { +Serve.prototype.wrapUserFeed = function (isScrolled, id) { var self = this return u.hyperwrap(function (thread, cb) { var done = multicb({pluck: 1, spread: true}) self.app.getAbout(id, done()) - self.app.getFriendInfo(id, done()) + if (!isScrolled) self.app.getFriendInfo(id, done()) done(function (err, about, info) { if (err) return cb(err) var done = multicb({pluck: 1, spread: true}) @@ -846,18 +847,20 @@ Serve.prototype.wrapUserFeed = function (id) { about.description ? h('div', {innerHTML: self.app.render.markdown(about.description)}) : '' )), - h('tr', - h('td', 'Friends:'), - h('td', self.friendList(info.friends, done())) - ), - h('tr', - h('td', 'Follows:'), - h('td', self.friendList(info.follows, done())) - ), - h('tr', - h('td', 'Followers:'), - h('td', self.friendList(info.followers, done())) - ) + isScrolled ? '' : [ + h('tr', + h('td', 'friends:'), + h('td', self.friendList(info.friends, done())) + ), + h('tr', + h('td', 'follows:'), + h('td', self.friendList(info.follows, done())) + ), + h('tr', + h('td', 'followers:'), + h('td', self.friendList(info.followers, done())) + ) + ] )), thread ]) -- cgit v1.2.3