Use new getter for content in MFileBody

pull/21833/head
Travis Ralston 2021-07-29 15:57:54 -06:00
parent bb1b2d10c8
commit 455c103890
1 changed files with 5 additions and 6 deletions

View File

@ -192,20 +192,19 @@ export default class MFileBody extends React.Component<IProps, IState> {
}; };
public render() { public render() {
const content = this.props.mxEvent.getContent<IMediaEventContent>();
const isEncrypted = this.props.mediaEventHelper.media.isEncrypted; const isEncrypted = this.props.mediaEventHelper.media.isEncrypted;
const contentUrl = this.getContentUrl(); const contentUrl = this.getContentUrl();
const fileSize = content.info ? content.info.size : null; const fileSize = this.content.info ? this.content.info.size : null;
const fileType = content.info ? content.info.mimetype : "application/octet-stream"; const fileType = this.content.info ? this.content.info.mimetype : "application/octet-stream";
let placeholder: React.ReactNode = null; let placeholder: React.ReactNode = null;
if (this.props.showGenericPlaceholder) { if (this.props.showGenericPlaceholder) {
placeholder = ( placeholder = (
<AccessibleButton className="mx_MediaBody mx_MFileBody_info" onClick={this.onPlaceholderClick}> <AccessibleButton className="mx_MediaBody mx_MFileBody_info" onClick={this.onPlaceholderClick}>
<span className="mx_MFileBody_info_icon" /> <span className="mx_MFileBody_info_icon" />
<TextWithTooltip tooltip={presentableTextForFile(content, _t("Attachment"), false)}> <TextWithTooltip tooltip={presentableTextForFile(this.content, _t("Attachment"), false)}>
<span className="mx_MFileBody_info_filename"> <span className="mx_MFileBody_info_filename">
{ presentableTextForFile(content, _t("Attachment"), true, true) } { presentableTextForFile(this.content, _t("Attachment"), true, true) }
</span> </span>
</TextWithTooltip> </TextWithTooltip>
</AccessibleButton> </AccessibleButton>
@ -318,7 +317,7 @@ export default class MFileBody extends React.Component<IProps, IState> {
{ _t("Download %(text)s", { text: this.linkText }) } { _t("Download %(text)s", { text: this.linkText }) }
</a> </a>
{ this.props.tileShape === TileShape.FileGrid && <div className="mx_MImageBody_size"> { this.props.tileShape === TileShape.FileGrid && <div className="mx_MImageBody_size">
{ content.info && content.info.size ? filesize(content.info.size) : "" } { this.content.info && this.content.info.size ? filesize(this.content.info.size) : "" }
</div> } </div> }
</div> } </div> }
</span> </span>