mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
breaking: remove socket.emit('categories.getCategory')
This commit is contained in:
@@ -4,8 +4,6 @@ const categories = require('../categories');
|
||||
const privileges = require('../privileges');
|
||||
const user = require('../user');
|
||||
const topics = require('../topics');
|
||||
const api = require('../api');
|
||||
const sockets = require('.');
|
||||
|
||||
const SocketCategories = module.exports;
|
||||
|
||||
@@ -149,12 +147,6 @@ SocketCategories.isModerator = async function (socket, cid) {
|
||||
return await user.isModerator(socket.uid, cid);
|
||||
};
|
||||
|
||||
SocketCategories.getCategory = async function (socket, cid) {
|
||||
sockets.warnDeprecated(socket, 'GET /api/v3/categories/:cid');
|
||||
return await api.categories.get(socket, { cid });
|
||||
// return await apiController.getCategoryData(cid, socket.uid);
|
||||
};
|
||||
|
||||
SocketCategories.loadMoreSubCategories = async function (socket, data) {
|
||||
if (!data || !data.cid || !(parseInt(data.start, 10) > 0)) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
|
||||
@@ -200,9 +200,9 @@ describe('Categories', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('socket methods', () => {
|
||||
describe('api/socket methods', () => {
|
||||
const socketCategories = require('../src/socket.io/categories');
|
||||
|
||||
const apiCategories = require('../src/api/categories');
|
||||
before(async () => {
|
||||
await Topics.post({
|
||||
uid: posterUid,
|
||||
@@ -339,12 +339,9 @@ describe('Categories', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should get category data', (done) => {
|
||||
socketCategories.getCategory({ uid: posterUid }, categoryObj.cid, (err, data) => {
|
||||
assert.ifError(err);
|
||||
it('should get category data', async () => {
|
||||
const data = await apiCategories.get({ uid: posterUid }, { cid: categoryObj.cid });
|
||||
assert.equal(categoryObj.cid, data.cid);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user