mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
fix tests
This commit is contained in:
@@ -207,11 +207,18 @@ module.exports = function (Topics) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doesTidHaveUnblockedUnreadPosts(uid, tid, callback) {
|
function doesTidHaveUnblockedUnreadPosts(uid, tid, callback) {
|
||||||
|
var topicTimestamp;
|
||||||
|
var userLastReadTimestamp;
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (next) {
|
function (next) {
|
||||||
db.sortedSetScore('uid:' + uid + ':tids_read', tid, next);
|
async.parallel({
|
||||||
|
topicTimestamp: async.apply(db.sortedSetScore, 'topics:recent', tid),
|
||||||
|
userLastReadTimestamp: async.apply(db.sortedSetScore, 'uid:' + uid + ':tids_read', tid),
|
||||||
|
}, next);
|
||||||
},
|
},
|
||||||
function (userLastReadTimestamp, next) {
|
function (results, next) {
|
||||||
|
topicTimestamp = results.topicTimestamp;
|
||||||
|
userLastReadTimestamp = results.userLastReadTimestamp;
|
||||||
if (!userLastReadTimestamp) {
|
if (!userLastReadTimestamp) {
|
||||||
return callback(null, true);
|
return callback(null, true);
|
||||||
}
|
}
|
||||||
@@ -219,7 +226,7 @@ module.exports = function (Topics) {
|
|||||||
},
|
},
|
||||||
function (pidsSinceLastVisit, next) {
|
function (pidsSinceLastVisit, next) {
|
||||||
if (!pidsSinceLastVisit.length) {
|
if (!pidsSinceLastVisit.length) {
|
||||||
return callback(null, false);
|
return callback(null, topicTimestamp > userLastReadTimestamp);
|
||||||
}
|
}
|
||||||
posts.getPostsFields(pidsSinceLastVisit, ['pid', 'uid'], next);
|
posts.getPostsFields(pidsSinceLastVisit, ['pid', 'uid'], next);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user