mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 07:55:46 +01:00
closes #3179
This commit is contained in:
@@ -68,7 +68,7 @@ define('forum/unread', ['forum/recent', 'topicSelect', 'forum/infinitescroll', '
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.emit('categories.get', onCategoriesLoaded);
|
socket.emit('categories.getWatchedCategories', onCategoriesLoaded);
|
||||||
|
|
||||||
topicSelect.init();
|
topicSelect.init();
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,21 @@ SocketCategories.get = function(socket, data, callback) {
|
|||||||
categories.getCategoriesByPrivilege(socket.uid, 'find', callback);
|
categories.getCategoriesByPrivilege(socket.uid, 'find', callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SocketCategories.getWatchedCategories = function(socket, data, callback) {
|
||||||
|
async.parallel({
|
||||||
|
categories: async.apply(categories.getCategoriesByPrivilege, socket.uid, 'find')
|
||||||
|
ignoredCids: async.apply(user.getIgnoredCategories, socket.uid)
|
||||||
|
}, function(err, results) {
|
||||||
|
if (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
var watchedCategories = results.categories.filter(function(category) {
|
||||||
|
return category && results.ignoredCids.indexOf(category.cid.toString()) === -1;
|
||||||
|
});
|
||||||
|
callback(null, watchedCategories);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
SocketCategories.loadMore = function(socket, data, callback) {
|
SocketCategories.loadMore = function(socket, data, callback) {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return callback(new Error('[[error:invalid-data]]'));
|
return callback(new Error('[[error:invalid-data]]'));
|
||||||
|
|||||||
Reference in New Issue
Block a user