|
|
@ -1,15 +1,14 @@
|
|
|
|
'use strict';
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
var async = require('async');
|
|
|
|
const nconf = require('nconf');
|
|
|
|
var nconf = require('nconf');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var categories = require('../categories');
|
|
|
|
const categories = require('../categories');
|
|
|
|
var meta = require('../meta');
|
|
|
|
const meta = require('../meta');
|
|
|
|
var helpers = require('./helpers');
|
|
|
|
const helpers = require('./helpers');
|
|
|
|
|
|
|
|
|
|
|
|
var categoriesController = module.exports;
|
|
|
|
const categoriesController = module.exports;
|
|
|
|
|
|
|
|
|
|
|
|
categoriesController.list = function (req, res, next) {
|
|
|
|
categoriesController.list = async function (req, res) {
|
|
|
|
res.locals.metaTags = [{
|
|
|
|
res.locals.metaTags = [{
|
|
|
|
name: 'title',
|
|
|
|
name: 'title',
|
|
|
|
content: String(meta.config.title || 'NodeBB'),
|
|
|
|
content: String(meta.config.title || 'NodeBB'),
|
|
|
@ -18,20 +17,11 @@ categoriesController.list = function (req, res, next) {
|
|
|
|
content: 'website',
|
|
|
|
content: 'website',
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
var categoryData;
|
|
|
|
const categoryData = await categories.getCategoriesByPrivilege('categories:cid', req.uid, 'find');
|
|
|
|
let tree;
|
|
|
|
const tree = categories.getTree(categoryData, 0);
|
|
|
|
async.waterfall([
|
|
|
|
await categories.getRecentTopicReplies(categoryData, req.uid);
|
|
|
|
function (next) {
|
|
|
|
|
|
|
|
categories.getCategoriesByPrivilege('categories:cid', req.uid, 'find', next);
|
|
|
|
const data = {
|
|
|
|
},
|
|
|
|
|
|
|
|
function (_categoryData, next) {
|
|
|
|
|
|
|
|
categoryData = _categoryData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tree = categories.getTree(categoryData, 0);
|
|
|
|
|
|
|
|
categories.getRecentTopicReplies(categoryData, req.uid, next);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
function () {
|
|
|
|
|
|
|
|
var data = {
|
|
|
|
|
|
|
|
title: meta.config.homePageTitle || '[[pages:home]]',
|
|
|
|
title: meta.config.homePageTitle || '[[pages:home]]',
|
|
|
|
categories: tree,
|
|
|
|
categories: tree,
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -57,6 +47,4 @@ categoriesController.list = function (req, res, next) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
res.render('categories', data);
|
|
|
|
res.render('categories', data);
|
|
|
|
},
|
|
|
|
|
|
|
|
], next);
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|