Only send HTML if we need to.

pull/21833/head
Kegan Dougal 2015-11-20 17:30:14 +00:00
parent 2e32383570
commit f5e2a54603
1 changed files with 11 additions and 8 deletions

View File

@ -311,9 +311,11 @@ module.exports = {
this.props.room.roomId, contentText.substring(4) this.props.room.roomId, contentText.substring(4)
); );
} }
else if (this.markdownEnabled) { else {
var htmlText = mdownToHtml(contentText);
if (this.markdownEnabled && htmlText !== contentText) {
sendMessagePromise = MatrixClientPeg.get().sendHtmlMessage( sendMessagePromise = MatrixClientPeg.get().sendHtmlMessage(
this.props.room.roomId, contentText, mdownToHtml(contentText) this.props.room.roomId, contentText, htmlText
); );
} }
else { else {
@ -321,6 +323,7 @@ module.exports = {
this.props.room.roomId, contentText this.props.room.roomId, contentText
); );
} }
}
sendMessagePromise.then(function() { sendMessagePromise.then(function() {
dis.dispatch({ dis.dispatch({