mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
fix: #7103
update counter when user navigates to /unread fix new topic alert on /unread moved unread code from footer to unread
This commit is contained in:
@@ -215,26 +215,26 @@ module.exports = function (Topics) {
|
||||
if (topic && topic.cid && cidMatch(topic.cid) && !blockedUids.includes(parseInt(topic.uid, 10))) {
|
||||
topic.tid = parseInt(topic.tid, 10);
|
||||
if ((results.isTopicsFollowed[index] || !isCidIgnored[topic.cid])) {
|
||||
counts[''] += 1;
|
||||
tidsByFilter[''].push(topic.tid);
|
||||
}
|
||||
|
||||
if (results.isTopicsFollowed[index]) {
|
||||
counts.watched += 1;
|
||||
tidsByFilter.watched.push(topic.tid);
|
||||
}
|
||||
|
||||
if (topic.postcount <= 1) {
|
||||
counts.unreplied += 1;
|
||||
tidsByFilter.unreplied.push(topic.tid);
|
||||
}
|
||||
|
||||
if (!userRead[topic.tid]) {
|
||||
counts.new += 1;
|
||||
tidsByFilter.new.push(topic.tid);
|
||||
}
|
||||
}
|
||||
});
|
||||
counts[''] = tidsByFilter[''].length;
|
||||
counts.watched = tidsByFilter.watched.length;
|
||||
counts.unreplied = tidsByFilter.unreplied.length;
|
||||
counts.new = tidsByFilter.new.length;
|
||||
|
||||
next(null, {
|
||||
counts: counts,
|
||||
@@ -439,10 +439,8 @@ module.exports = function (Topics) {
|
||||
};
|
||||
|
||||
Topics.hasReadTopics = function (tids, uid, callback) {
|
||||
if (!parseInt(uid, 10)) {
|
||||
return callback(null, tids.map(function () {
|
||||
return false;
|
||||
}));
|
||||
if (!(parseInt(uid, 10) > 0)) {
|
||||
return setImmediate(callback, null, tids.map(() => false));
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
|
||||
Reference in New Issue
Block a user