mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-13 23:52:17 +02:00
feat: ability to nickname remote categories, closes #13677
This commit is contained in:
@@ -65,9 +65,9 @@ categoriesController.getAll = async function (req, res) {
|
||||
}
|
||||
|
||||
const fields = [
|
||||
'cid', 'name', 'icon', 'parentCid', 'disabled', 'link',
|
||||
'cid', 'name', 'nickname', 'icon', 'parentCid', 'disabled', 'link',
|
||||
'order', 'color', 'bgColor', 'backgroundImage', 'imageClass',
|
||||
'subCategoriesPerPage', 'description',
|
||||
'subCategoriesPerPage', 'description', 'descriptionParsed',
|
||||
];
|
||||
let categoriesData = await categories.getCategoriesFields(cids, fields);
|
||||
({ categories: categoriesData } = await plugins.hooks.fire('filter:admin.categories.get', { categories: categoriesData, fields: fields }));
|
||||
@@ -213,6 +213,17 @@ categoriesController.addRemote = async function (req, res) {
|
||||
res.sendStatus(200);
|
||||
};
|
||||
|
||||
categoriesController.renameRemote = async (req, res) => {
|
||||
if (utils.isNumber(req.params.cid)) {
|
||||
return helpers.formatApiResponse(400, res);
|
||||
}
|
||||
|
||||
const { name } = req.body;
|
||||
await categories.setCategoryField(req.params.cid, 'nickname', name);
|
||||
|
||||
res.sendStatus(200);
|
||||
};
|
||||
|
||||
categoriesController.removeRemote = async function (req, res) {
|
||||
if (utils.isNumber(req.params.cid)) {
|
||||
return helpers.formatApiResponse(400, res);
|
||||
|
||||
Reference in New Issue
Block a user