mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
feat: closes #8440, allow configuring max topic count
This commit is contained in:
@@ -112,6 +112,7 @@
|
|||||||
"hideFullname": 0,
|
"hideFullname": 0,
|
||||||
"hideEmail": 0,
|
"hideEmail": 0,
|
||||||
"allowGuestHandles": 0,
|
"allowGuestHandles": 0,
|
||||||
|
"recentMaxTopics": 200,
|
||||||
"disableRecentCategoryFilter": 0,
|
"disableRecentCategoryFilter": 0,
|
||||||
"maximumRelatedTopics": 0,
|
"maximumRelatedTopics": 0,
|
||||||
"disableEmailSubscriptions": 0,
|
"disableEmailSubscriptions": 0,
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
"unread.cutoff": "Unread cutoff days",
|
"unread.cutoff": "Unread cutoff days",
|
||||||
"unread.min-track-last": "Minimum posts in topic before tracking last read",
|
"unread.min-track-last": "Minimum posts in topic before tracking last read",
|
||||||
"recent": "Recent Settings",
|
"recent": "Recent Settings",
|
||||||
|
"recent.max-topics": "Maximum topics on /recent",
|
||||||
"recent.categoryFilter.disable": "Disable filtering of topics in ignored categories on the /recent page",
|
"recent.categoryFilter.disable": "Disable filtering of topics in ignored categories on the /recent page",
|
||||||
"signature": "Signature Settings",
|
"signature": "Signature Settings",
|
||||||
"signature.disable": "Disable signatures",
|
"signature.disable": "Disable signatures",
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ module.exports = function (Topics) {
|
|||||||
}
|
}
|
||||||
data.tids = await getTids(params);
|
data.tids = await getTids(params);
|
||||||
data.tids = await sortTids(data.tids, params);
|
data.tids = await sortTids(data.tids, params);
|
||||||
data.tids = await filterTids(data.tids.slice(0, 200), params);
|
data.tids = await filterTids(data.tids.slice(0, meta.config.recentMaxTopics), params);
|
||||||
data.topicCount = data.tids.length;
|
data.topicCount = data.tids.length;
|
||||||
data.topics = await getTopics(data.tids, params);
|
data.topics = await getTopics(data.tids, params);
|
||||||
data.nextStart = params.stop + 1;
|
data.nextStart = params.stop + 1;
|
||||||
@@ -49,7 +49,7 @@ module.exports = function (Topics) {
|
|||||||
} else if (params.cids) {
|
} else if (params.cids) {
|
||||||
tids = await getCidTids(params);
|
tids = await getCidTids(params);
|
||||||
} else {
|
} else {
|
||||||
tids = await db.getSortedSetRevRange('topics:' + params.sort, 0, 199);
|
tids = await db.getSortedSetRevRange('topics:' + params.sort, 0, meta.config.recentMaxTopics - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tids;
|
return tids;
|
||||||
@@ -67,7 +67,7 @@ module.exports = function (Topics) {
|
|||||||
pinnedSets.push('cid:' + cid + ':tids:pinned');
|
pinnedSets.push('cid:' + cid + ':tids:pinned');
|
||||||
});
|
});
|
||||||
const [tids, pinnedTids] = await Promise.all([
|
const [tids, pinnedTids] = await Promise.all([
|
||||||
db.getSortedSetRevRange(sets, 0, 199),
|
db.getSortedSetRevRange(sets, 0, meta.config.recentMaxTopics - 1),
|
||||||
db.getSortedSetRevRange(pinnedSets, 0, -1),
|
db.getSortedSetRevRange(pinnedSets, 0, -1),
|
||||||
]);
|
]);
|
||||||
return pinnedTids.concat(tids);
|
return pinnedTids.concat(tids);
|
||||||
|
|||||||
@@ -210,6 +210,10 @@
|
|||||||
<div class="col-sm-2 col-xs-12 settings-header">[[admin/settings/post:recent]]</div>
|
<div class="col-sm-2 col-xs-12 settings-header">[[admin/settings/post:recent]]</div>
|
||||||
<div class="col-sm-10 col-xs-12">
|
<div class="col-sm-10 col-xs-12">
|
||||||
<form>
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="recentMaxTopics">[[admin/settings/post:recent.max-topics]]</label>
|
||||||
|
<input id="recentMaxTopics" type="text" class="form-control" value="200" data-field="recentMaxTopics">
|
||||||
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
|
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
|
||||||
<input class="mdl-switch__input" type="checkbox" data-field="disableRecentCategoryFilter">
|
<input class="mdl-switch__input" type="checkbox" data-field="disableRecentCategoryFilter">
|
||||||
|
|||||||
Reference in New Issue
Block a user