mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-30 18:46:01 +01:00 
			
		
		
		
	closes #5516
This commit is contained in:
		| @@ -206,7 +206,7 @@ module.exports = function (Topics) { | |||||||
| 	Topics.markAsRead = function (tids, uid, callback) { | 	Topics.markAsRead = function (tids, uid, callback) { | ||||||
| 		callback = callback || function () {}; | 		callback = callback || function () {}; | ||||||
| 		if (!Array.isArray(tids) || !tids.length) { | 		if (!Array.isArray(tids) || !tids.length) { | ||||||
| 			return callback(); | 			return setImmediate(callback, null, false); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		tids = tids.filter(function (tid, index, array) { | 		tids = tids.filter(function (tid, index, array) { | ||||||
| @@ -214,7 +214,7 @@ module.exports = function (Topics) { | |||||||
| 		}); | 		}); | ||||||
|  |  | ||||||
| 		if (!tids.length) { | 		if (!tids.length) { | ||||||
| 			return callback(null, false); | 			return setImmediate(callback, null, false); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		async.waterfall([ | 		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 () { | 	describe('tags', function () { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user