diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-18 07:45:05 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-18 07:45:05 -1000 |
commit | 1440f7c6fce5e03dd6c65f4a2e2f81c7d400ca5f (patch) | |
tree | 68ac7f2313965e3f9a54f944764f8a062830d2b3 /lib | |
parent | 657cbd53fd8ca892f632356e5e61175d56ce4f91 (diff) | |
download | patchfoo-1440f7c6fce5e03dd6c65f4a2e2f81c7d400ca5f.tar.gz patchfoo-1440f7c6fce5e03dd6c65f4a2e2f81c7d400ca5f.zip |
Handle ?sort=claimed in pagination links
Diffstat (limited to 'lib')
-rw-r--r-- | lib/serve.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/serve.js b/lib/serve.js index 32ea3e0..87ecbb4 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -1154,7 +1154,9 @@ Serve.prototype.renderThreadPaginated = function (opts, feedId, q) { return pull( paginate( function onFirst(msg, cb) { - var num = feedId ? msg.value.sequence : msg.timestamp || msg.ts + var num = feedId ? msg.value.sequence : + opts.sortByTimestamp ? msg.value.timestamp : + msg.timestamp || msg.ts if (q.forwards) { cb(null, links({ lt: num, @@ -1171,7 +1173,9 @@ Serve.prototype.renderThreadPaginated = function (opts, feedId, q) { }, this.app.render.renderFeeds(), function onLast(msg, cb) { - var num = feedId ? msg.value.sequence : msg.timestamp || msg.ts + var num = feedId ? msg.value.sequence : + opts.sortByTimestamp ? msg.value.timestamp : + msg.timestamp || msg.ts if (q.forwards) { cb(null, links({ lt: null, |