mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
Category watch state (#7109)
* feat: wip, category watch change * feat: pass data to client * feat: allow changing state * fix: account page categories * fix: show in unread if topic is followed or category is watched * feat: add default watch state to acp * feat: save user category watch state * feat: update unread recent pages * fix: remove dupe code * fix: flip conditions * fix: handle empty arrays * fix: ignore/watch on others profile * feat: upgrade script for category states if there are any users ignoring categories set their state in new zset and delete cid:<cid>:ignorers * fix: upgrade * fix: tests * fix: redis count * fix: more tests
This commit is contained in:
committed by
GitHub
parent
2104877c76
commit
eb7ae54f81
@@ -21,8 +21,8 @@ categoriesController.get = function (req, res, callback) {
|
||||
}
|
||||
|
||||
async.parallel({
|
||||
ignored: function (next) {
|
||||
user.getIgnoredCategories(userData.uid, next);
|
||||
states: function (next) {
|
||||
user.getCategoryWatchState(userData.uid, next);
|
||||
},
|
||||
categories: function (next) {
|
||||
categories.buildForSelect(userData.uid, 'find', next);
|
||||
@@ -32,7 +32,9 @@ categoriesController.get = function (req, res, callback) {
|
||||
function (results) {
|
||||
results.categories.forEach(function (category) {
|
||||
if (category) {
|
||||
category.isIgnored = results.ignored.includes(String(category.cid));
|
||||
category.isIgnored = results.states[category.cid] === categories.watchStates.ignoring;
|
||||
category.isWatched = results.states[category.cid] === categories.watchStates.watching;
|
||||
category.isNotWatched = results.states[category.cid] === categories.watchStates.notwatching;
|
||||
}
|
||||
});
|
||||
userData.categories = results.categories;
|
||||
|
||||
Reference in New Issue
Block a user