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 privileges = require('../privileges');
|
||||||
const user = require('../user');
|
const user = require('../user');
|
||||||
const topics = require('../topics');
|
const topics = require('../topics');
|
||||||
const api = require('../api');
|
|
||||||
const sockets = require('.');
|
|
||||||
|
|
||||||
const SocketCategories = module.exports;
|
const SocketCategories = module.exports;
|
||||||
|
|
||||||
@@ -149,12 +147,6 @@ SocketCategories.isModerator = async function (socket, cid) {
|
|||||||
return await user.isModerator(socket.uid, 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) {
|
SocketCategories.loadMoreSubCategories = async function (socket, data) {
|
||||||
if (!data || !data.cid || !(parseInt(data.start, 10) > 0)) {
|
if (!data || !data.cid || !(parseInt(data.start, 10) > 0)) {
|
||||||
throw new Error('[[error:invalid-data]]');
|
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 socketCategories = require('../src/socket.io/categories');
|
||||||
|
const apiCategories = require('../src/api/categories');
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await Topics.post({
|
await Topics.post({
|
||||||
uid: posterUid,
|
uid: posterUid,
|
||||||
@@ -339,12 +339,9 @@ describe('Categories', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get category data', (done) => {
|
it('should get category data', async () => {
|
||||||
socketCategories.getCategory({ uid: posterUid }, categoryObj.cid, (err, data) => {
|
const data = await apiCategories.get({ uid: posterUid }, { cid: categoryObj.cid });
|
||||||
assert.ifError(err);
|
assert.equal(categoryObj.cid, data.cid);
|
||||||
assert.equal(categoryObj.cid, data.cid);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user