Don't show for anything that doesn't have a msgtype and body

otherwise the server will just reject it anyway

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/3688/head
Michael Telatynski 2017-04-24 22:43:02 +01:00
parent 2eb715002f
commit 0a1ebc2487
1 changed files with 11 additions and 7 deletions

View File

@ -151,14 +151,18 @@ module.exports = React.createClass({
); );
} }
if (this.props.mxEvent.getType() === 'm.room.message' if (this.props.mxEvent.getType() === 'm.room.message') {
&& this.props.mxEvent.getContent().msgtype !== 'm.bad.encrypted') { const content = this.props.mxEvent.getContent();
if (content.msgtype // truthy check msgtype
&& content.msgtype !== 'm.bad.encrypted'
&& content.hasOwnProperty('body')) {
forwardButton = ( forwardButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onForwardClick}> <div className="mx_MessageContextMenu_field" onClick={this.onForwardClick}>
Forward Message Forward Message
</div> </div>
); );
} }
}
viewSourceButton = ( viewSourceButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onViewSourceClick}> <div className="mx_MessageContextMenu_field" onClick={this.onViewSourceClick}>