diff --git a/lib/models/room.js b/lib/models/room.js index ad586ff3f..eff95ed79 100644 --- a/lib/models/room.js +++ b/lib/models/room.js @@ -375,15 +375,13 @@ Room.prototype.recalculate = function(userId) { var readReceiptsForEvent = this.getReceiptsForEvent(e); - for (var receiptIt = 0; receiptIt < readReceiptsForEvent.length; ++receiptIt) { - var receipt = readReceiptsForEvent[receiptIt]; - if (receipt.type !== "m.read") { continue; } - - if (usersFound[receipt.userId]) { continue; } + readReceiptsForEvent.forEach(function(receipt) { + if (receipt.type !== "m.read") { return; } + if (usersFound[receipt.userId]) { return; } // Then this is the receipt we keep for this user usersFound[receipt.userId] = 1; - } + }); if (e.sender && usersFound[e.sender.userId] === undefined) { // no receipt yet for this sender, so we synthesize one.