mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 02:36:16 +01:00
fix: account/categories
This commit is contained in:
@@ -13,7 +13,7 @@ categoriesController.get = async function (req, res, next) {
|
|||||||
}
|
}
|
||||||
const [states, categoriesData] = await Promise.all([
|
const [states, categoriesData] = await Promise.all([
|
||||||
user.getCategoryWatchState(userData.uid),
|
user.getCategoryWatchState(userData.uid),
|
||||||
categories.buildForSelect(userData.uid, 'find', ['descriptionParsed', 'depth']),
|
categories.buildForSelect(userData.uid, 'find', ['descriptionParsed', 'depth', 'slug']),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
categoriesData.forEach(function (category) {
|
categoriesData.forEach(function (category) {
|
||||||
|
|||||||
@@ -105,17 +105,17 @@ SocketCategories.setWatchState = async function (socket, data) {
|
|||||||
if (!data || !data.cid || !data.state) {
|
if (!data || !data.cid || !data.state) {
|
||||||
throw new Error('[[error:invalid-data]]');
|
throw new Error('[[error:invalid-data]]');
|
||||||
}
|
}
|
||||||
await ignoreOrWatch(async function (uid, cid) {
|
return await ignoreOrWatch(async function (uid, cid) {
|
||||||
await user.setCategoryWatchState(uid, cid, categories.watchStates[data.state]);
|
await user.setCategoryWatchState(uid, cid, categories.watchStates[data.state]);
|
||||||
}, socket, data);
|
}, socket, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
SocketCategories.watch = async function (socket, data) {
|
SocketCategories.watch = async function (socket, data) {
|
||||||
await ignoreOrWatch(user.watchCategory, socket, data);
|
return await ignoreOrWatch(user.watchCategory, socket, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
SocketCategories.ignore = async function (socket, data) {
|
SocketCategories.ignore = async function (socket, data) {
|
||||||
await ignoreOrWatch(user.ignoreCategory, socket, data);
|
return await ignoreOrWatch(user.ignoreCategory, socket, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
async function ignoreOrWatch(fn, socket, data) {
|
async function ignoreOrWatch(fn, socket, data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user