From dbb9e9c456787b8897149bb96c869a0094e345d2 Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Fri, 3 Aug 2018 15:59:33 +0300 Subject: [PATCH] do not use prev cursor for first page --- lib/api/addresses.js | 2 +- lib/api/auth.js | 2 +- lib/api/dkim.js | 2 +- lib/api/domainaliases.js | 2 +- lib/api/messages.js | 6 +++--- lib/api/users.js | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/api/addresses.js b/lib/api/addresses.js index e92d79e0..0e35c6a4 100644 --- a/lib/api/addresses.js +++ b/lib/api/addresses.js @@ -189,7 +189,7 @@ module.exports = (db, server) => { if (pageNext) { opts.next = pageNext; - } else if (pagePrevious) { + } else if (page > 1 && pagePrevious) { opts.previous = pagePrevious; } diff --git a/lib/api/auth.js b/lib/api/auth.js index 73f9bf70..6c4a2d3f 100644 --- a/lib/api/auth.js +++ b/lib/api/auth.js @@ -329,7 +329,7 @@ module.exports = (db, server, userHandler) => { if (pageNext) { opts.next = pageNext; - } else if (pagePrevious) { + } else if (page > 1 && pagePrevious) { opts.previous = pagePrevious; } diff --git a/lib/api/dkim.js b/lib/api/dkim.js index e3ce51c4..b0c411c9 100644 --- a/lib/api/dkim.js +++ b/lib/api/dkim.js @@ -141,7 +141,7 @@ module.exports = (db, server) => { if (pageNext) { opts.next = pageNext; - } else if (pagePrevious) { + } else if (page > 1 && pagePrevious) { opts.previous = pagePrevious; } diff --git a/lib/api/domainaliases.js b/lib/api/domainaliases.js index 7d927b75..cb9b1528 100644 --- a/lib/api/domainaliases.js +++ b/lib/api/domainaliases.js @@ -141,7 +141,7 @@ module.exports = (db, server) => { if (pageNext) { opts.next = pageNext; - } else if (pagePrevious) { + } else if (page > 1 && pagePrevious) { opts.previous = pagePrevious; } diff --git a/lib/api/messages.js b/lib/api/messages.js index 65f5eb57..2631ee3f 100644 --- a/lib/api/messages.js +++ b/lib/api/messages.js @@ -256,7 +256,7 @@ module.exports = (db, server, messageHandler) => { if (pageNext) { opts.next = pageNext; - } else if (pagePrevious) { + } else if (page > 1 && pagePrevious) { opts.previous = pagePrevious; } @@ -692,7 +692,7 @@ module.exports = (db, server, messageHandler) => { if (pageNext) { opts.next = pageNext; - } else if (pagePrevious) { + } else if (page > 1 && pagePrevious) { opts.previous = pagePrevious; } @@ -2498,7 +2498,7 @@ module.exports = (db, server, messageHandler) => { if (pageNext) { opts.next = pageNext; - } else if (pagePrevious) { + } else if (page > 1 && pagePrevious) { opts.previous = pagePrevious; } diff --git a/lib/api/users.js b/lib/api/users.js index 60152da5..4c1c57e9 100644 --- a/lib/api/users.js +++ b/lib/api/users.js @@ -224,7 +224,7 @@ module.exports = (db, server, userHandler) => { if (pageNext) { opts.next = pageNext; - } else if (pagePrevious) { + } else if (page > 1 && pagePrevious) { opts.previous = pagePrevious; }