diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-23 06:58:03 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-23 06:58:03 +0100 |
| commit | 939932ca9e08512a65f2c40df2311cdda7a309d0 (patch) | |
| tree | 633684665c0b5f8896672969459cfc11fb3fd23d /bucky/app | |
| parent | dbb2d747323293e6ded68e5fd037ca3e01a7c6c2 (diff) | |
next page link on mailbox pages
Diffstat (limited to 'bucky/app')
| -rw-r--r-- | bucky/app/api.js | 1 | ||||
| -rw-r--r-- | bucky/app/bucky.js | 5 |
2 files changed, 5 insertions, 1 deletions
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() }) }, |
