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

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

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

@ -7,15 +7,6 @@ const sockets = require('..');
const Categories = module.exports;
Categories.create = async function (socket, data) {
sockets.warnDeprecated(socket, 'POST /api/v3/categories');
if (!data) {
throw new Error('[[error:invalid-data]]');
}
return await api.categories.create(socket, data);
};
Categories.getNames = async function () {
return await categories.getAllCategoryFields(['cid', 'name']);
};

@ -350,20 +350,17 @@ describe('Categories', () => {
describe('admin socket methods', () => {
const socketCategories = require('../src/socket.io/admin/categories');
const apiCategories = require('../src/api/categories');
let cid;
before((done) => {
socketCategories.create({ uid: adminUid }, {
before(async () => {
const category = await apiCategories.create({ uid: adminUid }, {
name: 'update name',
description: 'update description',
parentCid: categoryObj.cid,
icon: 'fa-check',
order: '5',
}, (err, category) => {
assert.ifError(err);
cid = category.cid;
done();
});
cid = category.cid;
});
it('should return error with invalid data', (done) => {

Loading…
Cancel
Save