You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Tweak duplicateStrategy code to reduce diff
This commit is contained in:
@@ -541,11 +541,10 @@ Room.prototype.addEvents = function(events, duplicateStrategy) {
|
|||||||
// N.B. account_data is added directly by /sync to avoid
|
// N.B. account_data is added directly by /sync to avoid
|
||||||
// having to maintain an event.isAccountData() here
|
// having to maintain an event.isAccountData() here
|
||||||
else {
|
else {
|
||||||
if (duplicateStrategy) {
|
var timeline = this._eventIdToTimeline[events[i].getId()];
|
||||||
|
if (timeline && duplicateStrategy) {
|
||||||
// is there a duplicate?
|
// is there a duplicate?
|
||||||
var shouldIgnore = false;
|
var shouldIgnore = false;
|
||||||
var timeline = this._eventIdToTimeline[events[i].getId()];
|
|
||||||
if (timeline) {
|
|
||||||
var tlEvents = timeline.getEvents();
|
var tlEvents = timeline.getEvents();
|
||||||
for (var j = 0; j < tlEvents.length; j++) {
|
for (var j = 0; j < tlEvents.length; j++) {
|
||||||
if (tlEvents[j].getId() === events[i].getId()) {
|
if (tlEvents[j].getId() === events[i].getId()) {
|
||||||
@@ -570,7 +569,6 @@ Room.prototype.addEvents = function(events, duplicateStrategy) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (shouldIgnore) {
|
if (shouldIgnore) {
|
||||||
continue; // skip the insertion of this event.
|
continue; // skip the insertion of this event.
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user