aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-12 18:03:56 -0700
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-12 18:51:16 -0700
commit84e5ab8d6281beeeadb18d7c411157498638749a (patch)
tree7b02d65e9b53299dc1c0a66f5e230503de3c2630
parent74ca52116504c6844d590ac07ef17ee788501924 (diff)
downloadpatchfoo-84e5ab8d6281beeeadb18d7c411157498638749a.tar.gz
patchfoo-84e5ab8d6281beeeadb18d7c411157498638749a.zip
Only show friends list on non-scrolled/paged feed
It takes up a lot of space. Leave room for the feed content
-rw-r--r--lib/serve.js33
1 files changed, 18 insertions, 15 deletions
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
])