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

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

@ -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',

@ -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');

@ -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({
});
await 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 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) => {

Loading…
Cancel
Save