Categories refactor (#9233)
* feat: wip categories pagination * feat: add subCategoriesPerPage setting * feat: add load more sub categories button to category page * fix: openapi spec * feat: show sub categories left on category page hide button when no more categories left * breaking: rename categories to allCategories on /search categories contains the search results * fix: spec * refactor: remove cidsPerPage * fix: tests * feat: use component for subcategories * fix: prevent negative subCategoriesLeftv1.18.x
parent
4c12e0aaf8
commit
d1364c3130
@ -1,10 +1,12 @@
|
|||||||
{
|
{
|
||||||
"pagination": "Pagination Settings",
|
"pagination": "Pagination Settings",
|
||||||
"enable": "Paginate topics and posts instead of using infinite scroll.",
|
"enable": "Paginate topics and posts instead of using infinite scroll.",
|
||||||
|
"posts": "Post Pagination",
|
||||||
"topics": "Topic Pagination",
|
"topics": "Topic Pagination",
|
||||||
"posts-per-page": "Posts per Page",
|
"posts-per-page": "Posts per Page",
|
||||||
"max-posts-per-page": "Maximum posts per page",
|
"max-posts-per-page": "Maximum posts per page",
|
||||||
"categories": "Category Pagination",
|
"categories": "Category Pagination",
|
||||||
"topics-per-page": "Topics per Page",
|
"topics-per-page": "Topics per Page",
|
||||||
"max-topics-per-page": "Maximum topics per page"
|
"max-topics-per-page": "Maximum topics per page",
|
||||||
|
"categories-per-page": "Categories per page"
|
||||||
}
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const db = require('../../database');
|
||||||
|
const batch = require('../../batch');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'Create subCategoriesPerPage property for categories',
|
||||||
|
timestamp: Date.UTC(2021, 0, 31),
|
||||||
|
method: async function () {
|
||||||
|
const progress = this.progress;
|
||||||
|
|
||||||
|
await batch.processSortedSet('categories:cid', async function (cids) {
|
||||||
|
const keys = cids.map(cid => 'category:' + cid);
|
||||||
|
await db.setObject(keys, {
|
||||||
|
subCategoriesPerPage: 10,
|
||||||
|
});
|
||||||
|
progress.incr(cids.length);
|
||||||
|
}, {
|
||||||
|
batch: 500,
|
||||||
|
progress: progress,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
Loading…
Reference in New Issue