mirror of https://github.com/vector-im/riot-web
Merge pull request #3194 from matrix-org/bwindels/fix-history-redactions
Don't try to call bodyToHtml with an empty contentpull/21833/head
commit
31723e9e5b
|
@ -119,22 +119,25 @@ export default class EditHistoryMessage extends React.PureComponent {
|
|||
const {mxEvent} = this.props;
|
||||
const originalContent = mxEvent.getOriginalContent();
|
||||
const content = originalContent["m.new_content"] || originalContent;
|
||||
const contentElements = HtmlUtils.bodyToHtml(content, null, {stripReplyFallback: true});
|
||||
let contentContainer;
|
||||
if (mxEvent.isRedacted()) {
|
||||
const UnknownBody = sdk.getComponent('messages.UnknownBody');
|
||||
contentContainer = <UnknownBody mxEvent={this.props.mxEvent} />;
|
||||
} else if (mxEvent.getContent().msgtype === "m.emote") {
|
||||
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
||||
contentContainer = (
|
||||
<div className="mx_EventTile_content" ref="content">*
|
||||
<span className="mx_MEmoteBody_sender">{ name }</span>
|
||||
{contentElements}
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
contentContainer = <div className="mx_EventTile_content" ref="content">{contentElements}</div>;
|
||||
const contentElements = HtmlUtils.bodyToHtml(content, null, {stripReplyFallback: true});
|
||||
if (mxEvent.getContent().msgtype === "m.emote") {
|
||||
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
||||
contentContainer = (
|
||||
<div className="mx_EventTile_content" ref="content">*
|
||||
<span className="mx_MEmoteBody_sender">{ name }</span>
|
||||
{contentElements}
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
contentContainer = <div className="mx_EventTile_content" ref="content">{contentElements}</div>;
|
||||
}
|
||||
}
|
||||
|
||||
const timestamp = formatTime(new Date(mxEvent.getTs()), this.props.isTwelveHour);
|
||||
const isSending = (['sending', 'queued', 'encrypting'].indexOf(this.state.sendStatus) !== -1);
|
||||
const classes = classNames({
|
||||
|
|
Loading…
Reference in New Issue