Use new pendingEventList functionality from matrix-js-sdk

Update react-sdk to use `pendingEventOrdering`==`detached` instead of
`end`. Look for pending events in the pendingEvent list, and use
MatrixClient.cancelPendingEvent to, uh, cancel pending events.
This commit is contained in:
Richard van der Hoff 2016-03-17 22:26:06 +00:00
parent d1dbce8adf
commit b93af2d536
4 changed files with 26 additions and 35 deletions

View file

@ -213,11 +213,6 @@ module.exports = React.createClass({
this.setState({
hasUnsentMessages: this._hasUnsentMessages(this.state.room)
});
case 'message_resend_started':
this.setState({
room: MatrixClientPeg.get().getRoom(this.props.roomId)
});
this.forceUpdate();
break;
case 'notifier_enabled':
case 'upload_failed':
@ -397,9 +392,7 @@ module.exports = React.createClass({
_getUnsentMessages: function(room) {
if (!room) { return []; }
// TODO: It would be nice if the JS SDK provided nicer constant-time
// constructs rather than O(N) (N=num msgs) on this.
return room.timeline.filter(function(ev) {
return room.getPendingEvents().filter(function(ev) {
return ev.status === Matrix.EventStatus.NOT_SENT;
});
},