v1.18.x
barisusakli 8 years ago
parent 1c1d97dd54
commit 0c8058ba9d

@ -206,7 +206,7 @@ module.exports = function (Topics) {
Topics.markAsRead = function (tids, uid, callback) {
callback = callback || function () {};
if (!Array.isArray(tids) || !tids.length) {
return callback();
return setImmediate(callback, null, false);
}
tids = tids.filter(function (tid, index, array) {
@ -214,7 +214,7 @@ module.exports = function (Topics) {
});
if (!tids.length) {
return callback(null, false);
return setImmediate(callback, null, false);
}
async.waterfall([

@ -1181,6 +1181,14 @@ describe('Topic\'s', function () {
});
});
});
it('should not do anything if tids is empty array', function (done) {
socketTopics.markAsRead({ uid: adminUid }, [], function (err, markedRead) {
assert.ifError(err);
assert(!markedRead);
done();
});
});
});
describe('tags', function () {

Loading…
Cancel
Save