fix: account/categories

v1.18.x
Barış Soner Uşaklı 5 years ago
parent 22b02f1407
commit 7a0f607434

@ -13,7 +13,7 @@ categoriesController.get = async function (req, res, next) {
}
const [states, categoriesData] = await Promise.all([
user.getCategoryWatchState(userData.uid),
categories.buildForSelect(userData.uid, 'find', ['descriptionParsed', 'depth']),
categories.buildForSelect(userData.uid, 'find', ['descriptionParsed', 'depth', 'slug']),
]);
categoriesData.forEach(function (category) {

@ -105,17 +105,17 @@ SocketCategories.setWatchState = async function (socket, data) {
if (!data || !data.cid || !data.state) {
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]);
}, 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) {
await ignoreOrWatch(user.ignoreCategory, socket, data);
return await ignoreOrWatch(user.ignoreCategory, socket, data);
};
async function ignoreOrWatch(fn, socket, data) {

Loading…
Cancel
Save