feat(forums): show forum attr of vipOnly/operOnly/readOnly

This commit is contained in:
OldHawk
2018-01-26 10:26:23 +08:00
parent dcadef34c8
commit 48d1c18cfa
2 changed files with 18 additions and 2 deletions

View File

@@ -32,8 +32,20 @@ var mtDebug = require(path.resolve('./config/lib/debug'));
* @param res
*/
exports.list = function (req, res) {
var condition = {};
if (!req.user.isOper) {
condition.operOnly = false;
}
if (!req.user.isOper && !req.user.isVip) {
condition.vipOnly = false;
}
console.log('------------------------condition------------------------');
console.log(condition);
var findForumsList = function (callback) {
Forum.find()
Forum.find(condition)
.sort('category order -createdat')
.populate({
path: 'lastTopic',
@@ -54,6 +66,7 @@ exports.list = function (req, res) {
var forumsTopicsCount = function (callback) {
Topic.aggregate({
// $match: condition,
$project: {
'forum': '$forum',
'year': {