feat: closes #8440, allow configuring max topic count

v1.18.x
Barış Soner Uşaklı 5 years ago
parent 0d0b951380
commit e09ab3dc19

@ -112,6 +112,7 @@
"hideFullname": 0,
"hideEmail": 0,
"allowGuestHandles": 0,
"recentMaxTopics": 200,
"disableRecentCategoryFilter": 0,
"maximumRelatedTopics": 0,
"disableEmailSubscriptions": 0,

@ -42,6 +42,7 @@
"unread.cutoff": "Unread cutoff days",
"unread.min-track-last": "Minimum posts in topic before tracking last read",
"recent": "Recent Settings",
"recent.max-topics": "Maximum topics on /recent",
"recent.categoryFilter.disable": "Disable filtering of topics in ignored categories on the /recent page",
"signature": "Signature Settings",
"signature.disable": "Disable signatures",

@ -26,7 +26,7 @@ module.exports = function (Topics) {
}
data.tids = await getTids(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.topics = await getTopics(data.tids, params);
data.nextStart = params.stop + 1;
@ -49,7 +49,7 @@ module.exports = function (Topics) {
} else if (params.cids) {
tids = await getCidTids(params);
} else {
tids = await db.getSortedSetRevRange('topics:' + params.sort, 0, 199);
tids = await db.getSortedSetRevRange('topics:' + params.sort, 0, meta.config.recentMaxTopics - 1);
}
return tids;
@ -67,7 +67,7 @@ module.exports = function (Topics) {
pinnedSets.push('cid:' + cid + ':tids:pinned');
});
const [tids, pinnedTids] = await Promise.all([
db.getSortedSetRevRange(sets, 0, 199),
db.getSortedSetRevRange(sets, 0, meta.config.recentMaxTopics - 1),
db.getSortedSetRevRange(pinnedSets, 0, -1),
]);
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-10 col-xs-12">
<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">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input class="mdl-switch__input" type="checkbox" data-field="disableRecentCategoryFilter">

Loading…
Cancel
Save