Node.js based forum software built for the modern web
unreadTotal route
psychobunnye193d58112af
diff --git a/src/controllers/categories.js b/src/controllers/categories.jsindex 84fe6833f0..82a4c0d135 100644--- a/src/controllers/categories.js+++ b/src/controllers/categories.js@@ -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,diff --git a/src/webserver.js b/src/webserver.jsindex d00e11ec0c..7316bb5f5b 100644--- a/src/webserver.js+++ b/src/webserver.js@@ -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);