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:
Barış Soner Uşaklı
2018-12-14 16:24:17 -05:00
committed by GitHub
parent 2104877c76
commit eb7ae54f81
28 changed files with 376 additions and 136 deletions

View File

@@ -228,6 +228,22 @@ describe('Sorted Set methods', function () {
});
});
it('should return empty array if count is 0', function (done) {
db.getSortedSetRevRangeByScore('sortedSetTest1', 0, 0, '+inf', '-inf', function (err, values) {
assert.ifError(err);
assert.deepEqual(values, []);
done();
});
});
it('should return elements from 1 to end', function (done) {
db.getSortedSetRevRangeByScore('sortedSetTest1', 1, -1, '+inf', '-inf', function (err, values) {
assert.ifError(err);
assert.deepEqual(values, ['value2', 'value1']);
done();
});
});
it('should return elements from 3 to last', function (done) {
db.sortedSetAdd('partialZset', [1, 2, 3, 4, 5], ['value1', 'value2', 'value3', 'value4', 'value5'], function (err) {
assert.ifError(err);
@@ -523,6 +539,15 @@ describe('Sorted Set methods', function () {
done();
});
});
it('should return empty array if keys is empty array', function (done) {
db.sortedSetsScore([], 'value1', function (err, scores) {
assert.equal(err, null);
assert.equal(arguments.length, 2);
assert.deepEqual(scores, []);
done();
});
});
});
describe('sortedSetScores()', function () {