1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-12 08:42:46 +03:00

forEach probably nicer here

This commit is contained in:
David Baker
2015-11-09 10:23:37 +00:00
parent 8b2f94a6b2
commit c13b1800b9

View File

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