diff --git a/src/components/views/messages/MessageComposer.js b/src/components/views/messages/MessageComposer.js index cad584b981..313dad3666 100644 --- a/src/components/views/messages/MessageComposer.js +++ b/src/components/views/messages/MessageComposer.js @@ -311,23 +311,21 @@ module.exports = React.createClass({ var isEmote = /^\/me /i.test(contentText); var sendMessagePromise; + if (isEmote) { - sendMessagePromise = MatrixClientPeg.get().sendEmoteMessage( - this.props.room.roomId, contentText.substring(4) - ); + contentText = contentText.substring(4); + } + + var htmlText; + if (this.markdownEnabled) && (htmlText = mdownToHtml(contentText)) !== contentText) { + sendMessagePromise = isEmote ? + MatrixClientPeg.get().sendHtmlEmote(this.props.room.roomId, contentText, htmlText) : + MatrixClientPeg.get().sendHtmlMessage(this.props.room.roomId, contentText, htmlText); } else { - var htmlText = mdownToHtml(contentText); - if (this.markdownEnabled && htmlText !== contentText) { - sendMessagePromise = MatrixClientPeg.get().sendHtmlMessage( - this.props.room.roomId, contentText, htmlText - ); - } - else { - sendMessagePromise = MatrixClientPeg.get().sendTextMessage( - this.props.room.roomId, contentText - ); - } + sendMessagePromise = isEmote ? + MatrixClientPeg.get().sendEmoteMessage(this.props.room.roomId, contentText) : + MatrixClientPeg.get().sendTextMessage(this.props.room.roomId, contentText); } sendMessagePromise.then(function() { diff --git a/src/components/views/messages/TextualMessage.js b/src/components/views/messages/TextualMessage.js index 7393e2e149..58d3520719 100644 --- a/src/components/views/messages/TextualMessage.js +++ b/src/components/views/messages/TextualMessage.js @@ -56,7 +56,7 @@ module.exports = React.createClass({ var name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender(); return ( - * {name} {content.body} + * { name } { body } ); case "m.notice":