mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 13:20:41 +01:00
breaking: remove deprecated socket.emit('admin.categories.create')
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user