Instead of sending HTML for any Entity, only send HTML for Links

Otherwise emoji messages are sent as HTML, needlessly
This commit is contained in:
Luke Barnard 2017-07-13 13:41:17 +01:00
parent be045a6dc0
commit 5826b6f22a

View file

@ -620,12 +620,13 @@ export default class MessageComposerInput extends React.Component {
}); });
} }
if (!shouldSendHTML) { if (!shouldSendHTML) {
const hasAnEntity = blocks.some((block) => { const hasLink = blocks.some((block) => {
return block.getCharacterList().filter((c) => { return block.getCharacterList().filter((c) => {
return c.getEntity(); const entityKey = c.getEntity();
return entityKey && Entity.get(entityKey).getType() === 'LINK';
}).size > 0; }).size > 0;
}); });
shouldSendHTML = hasAnEntity; shouldSendHTML = hasLink;
} }
if (shouldSendHTML) { if (shouldSendHTML) {
contentHTML = HtmlUtils.processHtmlForSending( contentHTML = HtmlUtils.processHtmlForSending(