mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
filter:category.get change #1527
This commit is contained in:
@@ -105,7 +105,9 @@ var db = require('./database'),
|
|||||||
category.isIgnored = results.isIgnored[0];
|
category.isIgnored = results.isIgnored[0];
|
||||||
category.topic_row_size = 'col-md-9';
|
category.topic_row_size = 'col-md-9';
|
||||||
|
|
||||||
plugins.fireHook('filter:category.get', category, data.uid, callback);
|
plugins.fireHook('filter:category.get', {category: category, uid: data.uid}, function(err, data) {
|
||||||
|
callback(err, data ? data.category : null);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ categoriesController.recent = function(req, res, next) {
|
|||||||
|
|
||||||
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
|
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
|
||||||
|
|
||||||
plugins.fireHook('filter:category.get', data, uid, function(err, data) {
|
plugins.fireHook('filter:category.get', {category: data, uid: uid}, function(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
res.render('recent', data);
|
res.render('recent', data.category);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -44,6 +44,7 @@ categoriesController.popular = function(req, res, next) {
|
|||||||
|
|
||||||
if (uid === 0) {
|
if (uid === 0) {
|
||||||
if (anonCache[term] && (Date.now() - lastUpdateTime) < 60 * 60 * 1000) {
|
if (anonCache[term] && (Date.now() - lastUpdateTime) < 60 * 60 * 1000) {
|
||||||
|
console.log('returning from cache');
|
||||||
return res.render('popular', anonCache[term]);
|
return res.render('popular', anonCache[term]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,16 +56,16 @@ categoriesController.popular = function(req, res, next) {
|
|||||||
|
|
||||||
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
|
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
|
||||||
|
|
||||||
plugins.fireHook('filter:category.get', {topics: data}, uid, function(err, data) {
|
plugins.fireHook('filter:category.get', {category: {topics: data}, uid: uid}, function(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
if (uid === 0) {
|
if (uid === 0) {
|
||||||
anonCache[term] = data;
|
anonCache[term] = data.category;
|
||||||
lastUpdateTime = Date.now();
|
lastUpdateTime = Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('popular', data);
|
res.render('popular', data.category);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -77,11 +78,11 @@ categoriesController.unread = function(req, res, next) {
|
|||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins.fireHook('filter:category.get', data, uid, function(err, data) {
|
plugins.fireHook('filter:category.get', {category: data, uid: uid}, function(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
res.render('unread', data);
|
res.render('unread', data.category);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -167,7 +168,7 @@ categoriesController.get = function(req, res, next) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
categories.getCategoryById,
|
categories.getCategoryById,
|
||||||
function(categoryData, uid, next) {
|
function(categoryData, next) {
|
||||||
categories.getRecentTopicReplies(categoryData.children, uid, function(err) {
|
categories.getRecentTopicReplies(categoryData.children, uid, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user