1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-10 09:22:25 +03:00

Merge pull request #6661 from matrix-org/travis/blurhash-opt

Ensure blurhash is treated as optional
This commit is contained in:
Travis Ralston
2021-08-23 22:56:32 -06:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -393,7 +393,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
const classes = classNames({ const classes = classNames({
'mx_MImageBody_thumbnail': true, 'mx_MImageBody_thumbnail': true,
'mx_MImageBody_thumbnail--blurhash': this.props.mxEvent.getContent().info[BLURHASH_FIELD], 'mx_MImageBody_thumbnail--blurhash': this.props.mxEvent.getContent().info?.[BLURHASH_FIELD],
}); });
// This has incredibly broken types. // This has incredibly broken types.
@@ -446,7 +446,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
// Overidden by MStickerBody // Overidden by MStickerBody
protected getPlaceholder(width: number, height: number): JSX.Element { protected getPlaceholder(width: number, height: number): JSX.Element {
const blurhash = this.props.mxEvent.getContent().info[BLURHASH_FIELD]; const blurhash = this.props.mxEvent.getContent().info?.[BLURHASH_FIELD];
if (blurhash) { if (blurhash) {
if (this.state.placeholder === 'no-image') { if (this.state.placeholder === 'no-image') {

View File

@@ -43,7 +43,7 @@ export default class MStickerBody extends MImageBody {
// Placeholder to show in place of the sticker image if // Placeholder to show in place of the sticker image if
// img onLoad hasn't fired yet. // img onLoad hasn't fired yet.
protected getPlaceholder(width: number, height: number): JSX.Element { protected getPlaceholder(width: number, height: number): JSX.Element {
if (this.props.mxEvent.getContent().info[BLURHASH_FIELD]) return super.getPlaceholder(width, height); if (this.props.mxEvent.getContent().info?.[BLURHASH_FIELD]) return super.getPlaceholder(width, height);
return <img src={require("../../../../res/img/icons-show-stickers.svg")} width="75" height="75" />; return <img src={require("../../../../res/img/icons-show-stickers.svg")} width="75" height="75" />;
} }