diff --git a/src/privileges/admin.js b/src/privileges/admin.js index c29cb60050..11ef66973b 100644 --- a/src/privileges/admin.js +++ b/src/privileges/admin.js @@ -77,7 +77,6 @@ privsAdmin.socketMap = { 'admin.analytics.get': 'admin:dashboard', 'admin.categories.update': 'admin:categories', - 'admin.categories.purge': 'admin:categories', 'admin.categories.copySettingsFrom': 'admin:categories', 'admin.categories.getPrivilegeSettings': 'admin:privileges', diff --git a/src/socket.io/admin/categories.js b/src/socket.io/admin/categories.js index 563cd310be..492d6811b3 100644 --- a/src/socket.io/admin/categories.js +++ b/src/socket.io/admin/categories.js @@ -11,12 +11,6 @@ Categories.getNames = async function () { return await categories.getAllCategoryFields(['cid', 'name']); }; -Categories.purge = async function (socket, cid) { - sockets.warnDeprecated(socket, 'DELETE /api/v3/categories/:cid'); - - await api.categories.delete(socket, { cid: cid }); -}; - Categories.update = async function (socket, data) { sockets.warnDeprecated(socket, 'PUT /api/v3/categories/:cid'); diff --git a/test/categories.js b/test/categories.js index 1f87a60a2c..78e953f8a9 100644 --- a/test/categories.js +++ b/test/categories.js @@ -348,7 +348,7 @@ describe('Categories', () => { }); }); - describe('admin socket methods', () => { + describe('admin api/socket methods', () => { const socketCategories = require('../src/socket.io/admin/categories'); const apiCategories = require('../src/api/categories'); let cid; @@ -449,25 +449,20 @@ describe('Categories', () => { assert(childrenCids.includes(String(cid))); }); - it('should purge category', (done) => { - Categories.create({ + it('should purge category', async () => { + const category = await Categories.create({ name: 'purge me', description: 'update description', - }, (err, category) => { - assert.ifError(err); - Topics.post({ - uid: posterUid, - cid: category.cid, - title: 'Test Topic Title', - content: 'The content of test topic', - }, (err) => { - assert.ifError(err); - socketCategories.purge({ uid: adminUid }, category.cid, (err) => { - assert.ifError(err); - done(); - }); - }); }); + await Topics.post({ + uid: posterUid, + cid: category.cid, + title: 'Test Topic Title', + content: 'The content of test topic', + }); + await apiCategories.delete({ uid: adminUid }, { cid: category.cid }); + const data = await Categories.getCategoryById(category.cid); + assert.strictEqual(data, null); }); it('should get all category names', (done) => {