mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
breaking: remove deprecated socket.emit('admin.categories.getAll')
This commit is contained in:
@@ -76,7 +76,6 @@ privsAdmin.socketMap = {
|
||||
'admin.rooms.getAll': 'admin:dashboard',
|
||||
'admin.analytics.get': 'admin:dashboard',
|
||||
|
||||
'admin.categories.getAll': 'admin:categories',
|
||||
'admin.categories.create': 'admin:categories',
|
||||
'admin.categories.update': 'admin:categories',
|
||||
'admin.categories.purge': 'admin:categories',
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const winston = require('winston');
|
||||
|
||||
const categories = require('../../categories');
|
||||
const plugins = require('../../plugins');
|
||||
const api = require('../../api');
|
||||
const sockets = require('..');
|
||||
|
||||
@@ -18,19 +16,6 @@ Categories.create = async function (socket, data) {
|
||||
return await api.categories.create(socket, data);
|
||||
};
|
||||
|
||||
// DEPRECATED: @1.14.3, remove in version >=1.16
|
||||
Categories.getAll = async function () {
|
||||
winston.warn('[deprecated] admin.categories.getAll deprecated, data is returned in the api route');
|
||||
const cids = await categories.getAllCidsFromSet('categories:cid');
|
||||
const fields = [
|
||||
'cid', 'name', 'icon', 'parentCid', 'disabled', 'link',
|
||||
'color', 'bgColor', 'backgroundImage', 'imageClass',
|
||||
];
|
||||
const categoriesData = await categories.getCategoriesFields(cids, fields);
|
||||
const result = await plugins.hooks.fire('filter:admin.categories.get', { categories: categoriesData, fields: fields });
|
||||
return categories.getTree(result.categories, 0);
|
||||
};
|
||||
|
||||
Categories.getNames = async function () {
|
||||
return await categories.getAllCategoryFields(['cid', 'name']);
|
||||
};
|
||||
|
||||
@@ -473,14 +473,6 @@ describe('Categories', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should get all categories', (done) => {
|
||||
socketCategories.getAll({ uid: adminUid }, {}, (err, data) => {
|
||||
assert.ifError(err);
|
||||
assert(data);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should get all category names', (done) => {
|
||||
socketCategories.getNames({ uid: adminUid }, {}, (err, data) => {
|
||||
assert.ifError(err);
|
||||
|
||||
Reference in New Issue
Block a user