From 7cde48e22a5a07d8824832eceeed7c0d7ea5b742 Mon Sep 17 00:00:00 2001 From: cel Date: Fri, 13 Oct 2017 21:04:18 -1000 Subject: Move limit downstream of filter --- lib/serve.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') 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), -- cgit v1.2.3