diff options
-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, |