summaryrefslogtreecommitdiff
path: root/bucky/app
diff options
context:
space:
mode:
Diffstat (limited to 'bucky/app')
-rw-r--r--bucky/app/api.js1
-rw-r--r--bucky/app/bucky.js5
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()
})
},