mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-19 02:50:53 +01:00
refactor(socket.io): deprecate categories.setWatchState in favour of api.categories.setWatchState
This commit is contained in:
@@ -11,6 +11,7 @@ const nconf = require('nconf');
|
||||
const file = require('../file');
|
||||
const user = require('../user');
|
||||
const groups = require('../groups');
|
||||
const categories = require('../categories');
|
||||
const topics = require('../topics');
|
||||
const posts = require('../posts');
|
||||
const messaging = require('../messaging');
|
||||
@@ -39,6 +40,14 @@ Assert.group = helpers.try(async (req, res, next) => {
|
||||
next();
|
||||
});
|
||||
|
||||
Assert.category = helpers.try(async (req, res, next) => {
|
||||
if (!await categories.exists(req.params.cid)) {
|
||||
return controllerHelpers.formatApiResponse(404, res, new Error('[[error:no-category]]'));
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
Assert.topic = helpers.try(async (req, res, next) => {
|
||||
if (!await topics.exists(req.params.tid)) {
|
||||
return controllerHelpers.formatApiResponse(404, res, new Error('[[error:no-topic]]'));
|
||||
|
||||
Reference in New Issue
Block a user