make forward_message be friendly with the RVS stuffs

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-06-16 16:12:52 +01:00
parent 6a2c2d64fa
commit 7b4cd31124
4 changed files with 53 additions and 35 deletions

View file

@ -523,6 +523,9 @@ module.exports = React.createClass({
payload.releaseNotes,
);
break;
case 'send_event':
this.onSendEvent(payload.room_id, payload.event);
break;
}
},
@ -1267,6 +1270,27 @@ module.exports = React.createClass({
});
},
onSendEvent: function(roomId, event) {
const cli = MatrixClientPeg.get();
if (!cli) {
dis.dispatch({action: 'message_send_failed'});
return;
}
cli.sendEvent(roomId, event.getType(), event.getContent()).done(() => {
dis.dispatch({action: 'message_sent'});
}, (err) => {
if (err.name === 'UnknownDeviceError') {
dis.dispatch({
action: 'unknown_device_error',
err: err,
room: cli.getRoom(roomId),
});
}
dis.dispatch({action: 'message_send_failed'});
});
},
updateStatusIndicator: function(state, prevState) {
let notifCount = 0;