mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-06 15:48:43 +02:00
Merge remote-tracking branch 'origin/master' into private-groups
This commit is contained in:
@@ -55,6 +55,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config['css-buster'] = meta.css.hash;
|
||||
config.requireEmailConfirmation = parseInt(meta.config.requireEmailConfirmation, 10) === 1;
|
||||
config.topicPostSort = meta.config.topicPostSort || 'oldest_to_newest';
|
||||
config.categoryTopicSort = meta.config.categoryTopicSort || 'newest_to_oldest';
|
||||
config.csrf_token = req.csrfToken();
|
||||
config.searchEnabled = plugins.hasListeners('filter:search.query');
|
||||
|
||||
@@ -79,6 +80,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.userLang = settings.language || config.defaultLang;
|
||||
config.openOutgoingLinksInNewTab = settings.openOutgoingLinksInNewTab;
|
||||
config.topicPostSort = settings.topicPostSort || config.topicPostSort;
|
||||
config.categoryTopicSort = settings.categoryTopicSort || config.categoryTopicSort;
|
||||
config.topicSearchEnabled = settings.topicSearchEnabled || false;
|
||||
|
||||
if (res.locals.isAPI) {
|
||||
|
||||
@@ -158,11 +158,23 @@ categoriesController.get = function(req, res, next) {
|
||||
topicIndex = 0;
|
||||
}
|
||||
|
||||
var set = 'cid:' + cid + ':tids',
|
||||
reverse = false;
|
||||
|
||||
if (settings.categoryTopicSort === 'newest_to_oldest') {
|
||||
reverse = true;
|
||||
} else if (settings.categoryTopicSort === 'most_posts') {
|
||||
reverse = true;
|
||||
set = 'cid:' + cid + ':tids:posts';
|
||||
}
|
||||
|
||||
var start = (page - 1) * settings.topicsPerPage + topicIndex,
|
||||
end = start + settings.topicsPerPage - 1;
|
||||
|
||||
next(null, {
|
||||
cid: cid,
|
||||
set: set,
|
||||
reverse: reverse,
|
||||
start: start,
|
||||
end: end,
|
||||
uid: uid
|
||||
@@ -171,6 +183,9 @@ categoriesController.get = function(req, res, next) {
|
||||
function(payload, next) {
|
||||
user.getUidByUserslug(req.query.author, function(err, uid) {
|
||||
payload.targetUid = uid;
|
||||
if (uid) {
|
||||
payload.set = 'cid:' + cid + ':uid:' + uid + ':tids';
|
||||
}
|
||||
next(err, payload);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -28,7 +28,12 @@ searchController.search = function(req, res, next) {
|
||||
|
||||
req.params.term = validator.escape(req.params.term);
|
||||
|
||||
search.search(req.params.term, req.query.in, uid, function(err, results) {
|
||||
search.search({
|
||||
query: req.params.term,
|
||||
searchIn: req.query.in,
|
||||
postedBy: req.query.by,
|
||||
uid: uid
|
||||
}, function(err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user