From 939932ca9e08512a65f2c40df2311cdda7a309d0 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 23 Dec 2017 06:58:03 +0100 Subject: next page link on mailbox pages --- bucky/app/api.js | 1 + bucky/app/bucky.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'bucky') diff --git a/bucky/app/api.js b/bucky/app/api.js index f0474a4..a8149d0 100644 --- a/bucky/app/api.js +++ b/bucky/app/api.js @@ -248,6 +248,7 @@ function route (app){ user: { id: req.user.get("id"), username: req.user.get("username") }, messages: res.messages, boxes: res.boxes, + query: res.query, }) }) app.get("/api/message/:id", diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js index 47eb7e1..b331688 100644 --- a/bucky/app/bucky.js +++ b/bucky/app/bucky.js @@ -592,8 +592,11 @@ var bucky = module.exports = { }) }, ensureMessages: function (req, res, next){ - db.getMessages(req.user.get('username'), req.params.box, 50, 0).then(function(messages){ + const limit = parseInt(req.query.limit) || 50 + const offset = parseInt(req.query.offset) || 0 + db.getMessages(req.user.get('username'), req.params.box, limit, offset).then(function(messages){ res.messages = messages + res.query = { limit, offset } next() }) }, -- cgit v1.2.3-70-g09d2