topic watching

This commit is contained in:
barisusakli
2016-05-18 19:02:43 +03:00
parent ef4a94857d
commit bf2133ed7c
17 changed files with 362 additions and 49 deletions

View File

@@ -87,6 +87,9 @@ module.exports = function(Topics) {
}
user.getIgnoredCategories(uid, next);
},
ignoredTids: function(next) {
user.getIgnoredTids(uid, 0, -1, next);
},
recentTids: function(next) {
db.getSortedSetRevRangeByScoreWithScores('topics:recent', 0, -1, '+inf', cutoff, next);
},
@@ -116,6 +119,9 @@ module.exports = function(Topics) {
});
var tids = results.recentTids.filter(function(recentTopic) {
if (results.ignoredTids.indexOf(recentTopic.value.toString()) !== -1) {
return false;
}
switch (filter) {
case 'new':
return !userRead[recentTopic.value];