avoid .done
and .then
anti-pattern
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
11ae0805b0
commit
db55f87699
2 changed files with 6 additions and 6 deletions
|
@ -914,14 +914,12 @@ module.exports = React.createClass({
|
|||
return;
|
||||
}
|
||||
|
||||
ContentMessages.sendContentToRoom(
|
||||
file, this.state.room.roomId, MatrixClientPeg.get(),
|
||||
).done(() => {
|
||||
ContentMessages.sendContentToRoom(file, this.state.room.roomId, MatrixClientPeg.get()).then(() => {
|
||||
// Send message_sent callback, for things like _checkIfAlone because after all a file is still a message.
|
||||
dis.dispatch({
|
||||
action: 'message_sent',
|
||||
});
|
||||
}, (error) => {
|
||||
}).catch((error) => {
|
||||
if (error.name === "UnknownDeviceError") {
|
||||
// Let the status bar handle this
|
||||
return;
|
||||
|
|
|
@ -877,11 +877,13 @@ export default class MessageComposerInput extends React.Component {
|
|||
}
|
||||
|
||||
|
||||
this.client.sendMessage(this.props.room.roomId, content).done((res) => {
|
||||
this.client.sendMessage(this.props.room.roomId, content).then((res) => {
|
||||
dis.dispatch({
|
||||
action: 'message_sent',
|
||||
});
|
||||
}, (e) => onSendMessageFailed(e, this.props.room));
|
||||
}).catch((e) => {
|
||||
onSendMessageFailed(e, this.props.room);
|
||||
});
|
||||
|
||||
this.setState({
|
||||
editorState: this.createEditorState(),
|
||||
|
|
Loading…
Reference in a new issue