1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22: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);
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.