properly filter /unread /recent /popular /top (#7927)

* feat: add failing test for pagination

* feat: test

* fix: redis tests

* refactor: remove logs

* fix: add new test

* feat: make sortedSetRangeByScore work with keys on redis

* fix: hardcoded set name

* feat: show topics from readable categories on recent/popular/top

* feat: rewrite unread topics

respect watched categories and followed topics

* fix: term + watched
This commit is contained in:
Barış Soner Uşaklı
2019-09-26 21:55:49 -04:00
committed by GitHub
parent 17437897f9
commit 310c6fd33f
12 changed files with 171 additions and 193 deletions

View File

@@ -1190,14 +1190,14 @@ describe('Topic\'s', function () {
topic: function (next) {
topics.post({ uid: topic.userId, title: 'unread topic', content: 'unread topic content', cid: topic.categoryId }, next);
},
user: function (next) {
joeUid: function (next) {
User.create({ username: 'regularJoe' }, next);
},
}, function (err, results) {
assert.ifError(err);
tid = results.topic.topicData.tid;
mainPid = results.topic.postData.pid;
uid = results.user;
uid = results.joeUid;
done();
});
});
@@ -1385,7 +1385,7 @@ describe('Topic\'s', function () {
},
function (category, next) {
privateCid = category.cid;
privileges.categories.rescind(['read'], category.cid, 'registered-users', next);
privileges.categories.rescind(['topics:read'], category.cid, 'registered-users', next);
},
function (next) {
topics.post({ uid: adminUid, title: 'topic in private category', content: 'registered-users cant see this', cid: privateCid }, next);
@@ -1414,7 +1414,7 @@ describe('Topic\'s', function () {
},
function (category, next) {
ignoredCid = category.cid;
privileges.categories.rescind(['read'], category.cid, 'registered-users', next);
privileges.categories.rescind(['topics:read'], category.cid, 'registered-users', next);
},
function (next) {
topics.post({ uid: adminUid, title: 'topic in private category', content: 'registered-users cant see this', cid: ignoredCid }, next);