unreadTotal route

v1.18.x
psychobunny 11 years ago
parent 08c0a7fa5e
commit e193d58112

@ -57,6 +57,22 @@ categoriesController.unread = function(req, res, next) {
});
};
categoriesController.unreadTotal = function(req, res, next) {
var uid = req.user.uid;
topics.getTotalUnread(uid, function (err, data) {
if(err) {
return next(err);
}
if (res.locals.isAPI) {
res.json(data);
} else {
res.render('unread', data);
}
});
};
categoriesController.get = function(req, res, next) {
var cid = req.params.category_id,
page = req.query.page || 1,

@ -629,8 +629,11 @@ process.on('uncaughtException', function(err) {
app.get('/recent/:term?', app.buildHeader, controllers.categories.recent);
app.get('/api/recent/:term?', app.prepareAPI, controllers.categories.recent);
app.get('/unread/:term?', app.buildHeader, app.authenticate, controllers.categories.unread);
app.get('/api/unread/:term?', app.prepareAPI, app.authenticate, controllers.categories.unread);
app.get('/unread/', app.buildHeader, app.authenticate, controllers.categories.unread);
app.get('/api/unread/', app.prepareAPI, app.authenticate, controllers.categories.unread);
app.get('/unread/total', app.buildHeader, app.authenticate, controllers.categories.unreadTotal);
app.get('/api/unread/total', app.prepareAPI, app.authenticate, controllers.categories.unreadTotal);
app.get('/category/:category_id/:slug?', app.buildHeader, controllers.categories.get);
app.get('/api/category/:category_id/:slug?', app.prepareAPI, controllers.categories.get);

Loading…
Cancel
Save