mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
breaking: remove deprecated socket.emit('admin.categories.purge')
This commit is contained in:
@@ -77,7 +77,6 @@ privsAdmin.socketMap = {
|
|||||||
'admin.analytics.get': 'admin:dashboard',
|
'admin.analytics.get': 'admin:dashboard',
|
||||||
|
|
||||||
'admin.categories.update': 'admin:categories',
|
'admin.categories.update': 'admin:categories',
|
||||||
'admin.categories.purge': 'admin:categories',
|
|
||||||
'admin.categories.copySettingsFrom': 'admin:categories',
|
'admin.categories.copySettingsFrom': 'admin:categories',
|
||||||
|
|
||||||
'admin.categories.getPrivilegeSettings': 'admin:privileges',
|
'admin.categories.getPrivilegeSettings': 'admin:privileges',
|
||||||
|
|||||||
@@ -11,12 +11,6 @@ Categories.getNames = async function () {
|
|||||||
return await categories.getAllCategoryFields(['cid', 'name']);
|
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) {
|
Categories.update = async function (socket, data) {
|
||||||
sockets.warnDeprecated(socket, 'PUT /api/v3/categories/:cid');
|
sockets.warnDeprecated(socket, 'PUT /api/v3/categories/:cid');
|
||||||
|
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ describe('Categories', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('admin socket methods', () => {
|
describe('admin api/socket methods', () => {
|
||||||
const socketCategories = require('../src/socket.io/admin/categories');
|
const socketCategories = require('../src/socket.io/admin/categories');
|
||||||
const apiCategories = require('../src/api/categories');
|
const apiCategories = require('../src/api/categories');
|
||||||
let cid;
|
let cid;
|
||||||
@@ -449,25 +449,20 @@ describe('Categories', () => {
|
|||||||
assert(childrenCids.includes(String(cid)));
|
assert(childrenCids.includes(String(cid)));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should purge category', (done) => {
|
it('should purge category', async () => {
|
||||||
Categories.create({
|
const category = await Categories.create({
|
||||||
name: 'purge me',
|
name: 'purge me',
|
||||||
description: 'update description',
|
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) => {
|
it('should get all category names', (done) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user