Recent refactor (#6879)

* wip

* fix inf scroll

* remove duplicated code

* remove dupe code in /unread

* use topicList

* update tag page to use topicList

* fix tests

* combine ifs

* remove more dupe code

* disable timeout
This commit is contained in:
Barış Soner Uşaklı
2018-10-27 06:26:50 -04:00
committed by GitHub
parent aa301f27a1
commit c27be9db5a
20 changed files with 377 additions and 585 deletions

View File

@@ -1064,7 +1064,7 @@ describe('Topic\'s', function () {
});
it('should error with invalid data', function (done) {
socketTopics.loadMoreUnreadTopics({ uid: adminUid }, { after: 'invalid' }, function (err) {
socketTopics.loadMoreSortedTopics({ uid: adminUid }, { after: 'invalid' }, function (err) {
assert.equal(err.message, '[[error:invalid-data]]');
done();
});
@@ -1073,7 +1073,7 @@ describe('Topic\'s', function () {
it('should load more unread topics', function (done) {
socketTopics.markUnread({ uid: adminUid }, tid, function (err) {
assert.ifError(err);
socketTopics.loadMoreUnreadTopics({ uid: adminUid }, { cid: topic.categoryId, after: 0, count: 10 }, function (err, data) {
socketTopics.loadMoreSortedTopics({ uid: adminUid }, { cid: topic.categoryId, after: 0, count: 10, sort: 'unread' }, function (err, data) {
assert.ifError(err);
assert(data);
assert(Array.isArray(data.topics));
@@ -1083,7 +1083,7 @@ describe('Topic\'s', function () {
});
it('should error with invalid data', function (done) {
socketTopics.loadMoreRecentTopics({ uid: adminUid }, { after: 'invalid' }, function (err) {
socketTopics.loadMoreSortedTopics({ uid: adminUid }, { after: 'invalid' }, function (err) {
assert.equal(err.message, '[[error:invalid-data]]');
done();
});
@@ -1091,7 +1091,7 @@ describe('Topic\'s', function () {
it('should load more recent topics', function (done) {
socketTopics.loadMoreRecentTopics({ uid: adminUid }, { cid: topic.categoryId, after: 0, count: 10 }, function (err, data) {
socketTopics.loadMoreSortedTopics({ uid: adminUid }, { cid: topic.categoryId, after: 0, count: 10, sort: 'recent' }, function (err, data) {
assert.ifError(err);
assert(data);
assert(Array.isArray(data.topics));