fix for a broken "send" button

This commit is contained in:
or-else
2018-08-08 21:07:18 +03:00
parent ff5096cd47
commit 45acee4617
+10 -4
View File
@@ -4680,12 +4680,18 @@ class AppView extends React.Component {
// User is sending a message, either plain text or a drafty object with attachments.
handleSendMessage(msg, promise, uploader) {
let topic = Tinode.getTopic(this.state.topicSelected);
msg = topic.createMessage(Drafty.parse(msg) || msg);
let dft = Drafty.parse(msg);
if (dft && !Drafty.isPlainText(dft)) {
msg = dft;
}
msg = topic.createMessage(msg);
msg._uploader = uploader;
promise.catch((err) => {
this.handleError(err.message, "err");
});
if (promise) {
promise.catch((err) => {
this.handleError(err.message, "err");
});
}
topic.publishDraft(msg, promise)
.catch((err) => {
this.handleError(err.message, "err");