breaking: remove deprecated socket.emit('admin.categories.getAll')

isekai-main
Barış Soner Uşaklı 3 years ago
parent f8f0a83b52
commit 10c19af2ad

@ -76,7 +76,6 @@ privsAdmin.socketMap = {
'admin.rooms.getAll': 'admin:dashboard', 'admin.rooms.getAll': 'admin:dashboard',
'admin.analytics.get': 'admin:dashboard', 'admin.analytics.get': 'admin:dashboard',
'admin.categories.getAll': 'admin:categories',
'admin.categories.create': 'admin:categories', 'admin.categories.create': 'admin:categories',
'admin.categories.update': 'admin:categories', 'admin.categories.update': 'admin:categories',
'admin.categories.purge': 'admin:categories', 'admin.categories.purge': 'admin:categories',

@ -1,9 +1,7 @@
'use strict'; 'use strict';
const winston = require('winston');
const categories = require('../../categories'); const categories = require('../../categories');
const plugins = require('../../plugins');
const api = require('../../api'); const api = require('../../api');
const sockets = require('..'); const sockets = require('..');
@ -18,19 +16,6 @@ Categories.create = async function (socket, data) {
return await api.categories.create(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 () { Categories.getNames = async function () {
return await categories.getAllCategoryFields(['cid', 'name']); 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) => { it('should get all category names', (done) => {
socketCategories.getNames({ uid: adminUid }, {}, (err, data) => { socketCategories.getNames({ uid: adminUid }, {}, (err, data) => {
assert.ifError(err); assert.ifError(err);

Loading…
Cancel
Save