1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Prevent messages from being sent if other messages have failed to send

Fixes https://github.com/vector-im/riot-web/issues/5408
This commit is contained in:
Travis Ralston
2018-11-08 16:46:03 -07:00
parent eafba9c7ef
commit c9a79bf32e
2 changed files with 11 additions and 0 deletions

View File

@@ -1186,6 +1186,13 @@ MatrixClient.prototype.sendEvent = function(roomId, eventType, content, txnId,
room.addPendingEvent(localEvent, txnId);
}
// addPendingEvent can change the state to NOT_SENT if it believes
// that there's other events that have failed. We won't bother to
// try sending the event if the state has changed as such.
if (localEvent.status === EventStatus.NOT_SENT) {
return Promise.reject(new Error("Event blocked by other events not yet sent"));
}
return _sendEvent(this, room, localEvent, callback);
};