diff --git a/src/privileges/admin.js b/src/privileges/admin.js index dcf7cfa947..c29cb60050 100644 --- a/src/privileges/admin.js +++ b/src/privileges/admin.js @@ -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', diff --git a/src/socket.io/admin/categories.js b/src/socket.io/admin/categories.js index af45e1643d..563cd310be 100644 --- a/src/socket.io/admin/categories.js +++ b/src/socket.io/admin/categories.js @@ -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']); }; diff --git a/test/categories.js b/test/categories.js index 0f9c4d7c9c..1f87a60a2c 100644 --- a/test/categories.js +++ b/test/categories.js @@ -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) => {