diff --git a/lib/models/room.js b/lib/models/room.js index eff95ed79..ad586ff3f 100644 --- a/lib/models/room.js +++ b/lib/models/room.js @@ -375,13 +375,15 @@ Room.prototype.recalculate = function(userId) { var readReceiptsForEvent = this.getReceiptsForEvent(e); - readReceiptsForEvent.forEach(function(receipt) { - if (receipt.type !== "m.read") { return; } - if (usersFound[receipt.userId]) { return; } + for (var receiptIt = 0; receiptIt < readReceiptsForEvent.length; ++receiptIt) { + var receipt = readReceiptsForEvent[receiptIt]; + if (receipt.type !== "m.read") { continue; } + + if (usersFound[receipt.userId]) { continue; } // 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.