aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-10-13 21:04:18 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-10-13 21:04:18 -1000
commit7cde48e22a5a07d8824832eceeed7c0d7ea5b742 (patch)
tree44cc12669aa8a63635a2120265794bd4ec8e54fc /lib/serve.js
parent7a16575265ccf7a79b53ee5a6cb1c8732e5c79ea (diff)
downloadpatchfoo-7cde48e22a5a07d8824832eceeed7c0d7ea5b742.tar.gz
patchfoo-7cde48e22a5a07d8824832eceeed7c0d7ea5b742.zip
Move limit downstream of filter
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/serve.js b/lib/serve.js
index e8adf3a..326c6cd 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -344,7 +344,6 @@ Serve.prototype.public = function (ext) {
sortByTimestamp: q.sort === 'claimed',
lt: Number(q.lt) || Date.now(),
gt: Number(q.gt) || -Infinity,
- limit: Number(q.limit) || 12,
filter: q.filter,
}
@@ -352,6 +351,7 @@ Serve.prototype.public = function (ext) {
this.app.createLogStream(opts),
this.renderThreadPaginated(opts, null, q),
this.wrapMessages(),
+ pull.take(Number(q.limit) || 12),
this.wrapPublic(),
this.wrapPage('public'),
this.respondSink(200, {
@@ -417,12 +417,12 @@ Serve.prototype.private = function (ext) {
reverse: !q.forwards,
lt: Number(q.lt) || Date.now(),
gt: Number(q.gt) || -Infinity,
- limit: Number(q.limit) || 12,
filter: q.filter,
}
pull(
this.app.streamPrivate(opts),
+ pull.take(Number(q.limit) || 12),
this.renderThreadPaginated(opts, null, q),
this.wrapMessages(),
this.wrapPrivate(opts),
@@ -441,7 +441,6 @@ Serve.prototype.mentions = function (ext) {
sortByTimestamp: q.sort === 'claimed',
lt: Number(q.lt) || Date.now(),
gt: Number(q.gt) || -Infinity,
- limit: Number(q.limit) || 12,
filter: q.filter,
}
@@ -450,6 +449,7 @@ Serve.prototype.mentions = function (ext) {
ph('h3', 'Mentions'),
pull(
self.app.streamMentions(opts),
+ pull.take(Number(q.limit) || 12),
self.app.unboxMessages(),
self.renderThreadPaginated(opts, null, q),
self.wrapMessages()
@@ -904,13 +904,13 @@ Serve.prototype.type = function (path) {
reverse: !q.forwards,
lt: Number(q.lt) || Date.now(),
gt: Number(q.gt) || -Infinity,
- limit: Number(q.limit) || 12,
type: type,
filter: q.filter,
}
pull(
this.app.sbot.messagesByType(opts),
+ pull.take(Number(q.limit) || 12),
this.renderThreadPaginated(opts, null, q),
this.wrapMessages(),
this.wrapType(type),
@@ -970,13 +970,13 @@ Serve.prototype.channel = function (path) {
reverse: !q.forwards,
lt: lt,
gt: gt,
- limit: Number(q.limit) || 12,
channel: channel,
filter: q.filter,
}
pull(
this.app.streamChannel(opts),
+ pull.take(Number(q.limit) || 12),
this.renderThreadPaginated(opts, null, q),
this.wrapMessages(),
this.wrapChannel(channel),
@@ -1049,7 +1049,6 @@ Serve.prototype.userFeed = function (id, path) {
reverse: !q.forwards,
lt: Number(q.lt) || Date.now(),
gt: Number(q.gt) || -Infinity,
- limit: Number(q.limit) || 20,
feed: id,
filter: q.filter,
}
@@ -1059,6 +1058,7 @@ Serve.prototype.userFeed = function (id, path) {
if (err) self.app.error(err)
pull(
self.app.sbot.createUserStream(opts),
+ pull.take(Number(q.limit) || 20),
self.renderThreadPaginated(opts, id, q),
self.wrapMessages(),
self.wrapUserFeed(isScrolled, id),