Add settings page to control watched categories (#6648)

* Add settings page to control watched categories

* Fix passing undefined to pushUnreadCount
This commit is contained in:
André Zanghelini
2018-10-05 14:00:18 -03:00
committed by Barış Soner Uşaklı
parent f5f3da12e7
commit 523a2dc54c
5 changed files with 118 additions and 3 deletions

View File

@@ -174,6 +174,8 @@ SocketCategories.ignore = function (socket, cid, callback) {
};
function ignoreOrWatch(fn, socket, cid, callback) {
var cids = [parseInt(cid, 10)];
async.waterfall([
function (next) {
db.getSortedSetRange('categories:cid', 0, -1, next);
@@ -187,10 +189,7 @@ function ignoreOrWatch(fn, socket, cid, callback) {
c.parentCid = parseInt(c.parentCid, 10);
});
var cids = [parseInt(cid, 10)];
// filter to subcategories of cid
var cat;
do {
cat = categoryData.find(function (c) {
@@ -208,6 +207,9 @@ function ignoreOrWatch(fn, socket, cid, callback) {
function (next) {
topics.pushUnreadCount(socket.uid, next);
},
function (next) {
next(null, cids);
},
], callback);
}