mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: returning category data in tags page
For nodebb/nodebb-theme-persona#483
This commit is contained in:
@@ -4,6 +4,7 @@ var async = require('async');
|
|||||||
var validator = require('validator');
|
var validator = require('validator');
|
||||||
|
|
||||||
var user = require('../user');
|
var user = require('../user');
|
||||||
|
var categories = require('../categories');
|
||||||
var topics = require('../topics');
|
var topics = require('../topics');
|
||||||
var privileges = require('../privileges');
|
var privileges = require('../privileges');
|
||||||
var pagination = require('../pagination');
|
var pagination = require('../pagination');
|
||||||
@@ -40,12 +41,19 @@ tagsController.getTag = function (req, res, next) {
|
|||||||
tids: function (next) {
|
tids: function (next) {
|
||||||
topics.getTagTids(req.params.tag, start, stop, next);
|
topics.getTagTids(req.params.tag, start, stop, next);
|
||||||
},
|
},
|
||||||
|
categories: function (next) {
|
||||||
|
const states = [categories.watchStates.watching, categories.watchStates.notwatching, categories.watchStates.ignoring];
|
||||||
|
helpers.getCategoriesByStates(req.uid, '', states, next);
|
||||||
|
},
|
||||||
}, next);
|
}, next);
|
||||||
},
|
},
|
||||||
function (results, next) {
|
function (results, next) {
|
||||||
if (Array.isArray(results.tids) && !results.tids.length) {
|
if (Array.isArray(results.tids) && !results.tids.length) {
|
||||||
return res.render('tag', templateData);
|
return res.render('tag', templateData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
templateData.categories = results.categories.categories;
|
||||||
|
|
||||||
topicCount = results.topicCount;
|
topicCount = results.topicCount;
|
||||||
topics.getTopics(results.tids, req.uid, next);
|
topics.getTopics(results.tids, req.uid, next);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user