Merge pull request #5129 from matrix-org/t3chguy/fix/14989

Clear url previews if they all get edited out of the event
This commit is contained in:
Michael Telatynski 2020-08-19 11:40:57 +01:00 committed by GitHub
commit d700a5a78c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -172,6 +172,8 @@ export default createReactClass({
const hidden = global.localStorage.getItem("hide_preview_" + this.props.mxEvent.getId()); const hidden = global.localStorage.getItem("hide_preview_" + this.props.mxEvent.getId());
this.setState({ widgetHidden: hidden }); this.setState({ widgetHidden: hidden });
} }
} else if (this.state.links.length) {
this.setState({ links: [] });
} }
} }
}, },

View file

@ -134,7 +134,7 @@ export default createReactClass({
const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
return ( return (
<div className="mx_LinkPreviewWidget" > <div className="mx_LinkPreviewWidget">
{ img } { img }
<div className="mx_LinkPreviewWidget_caption"> <div className="mx_LinkPreviewWidget_caption">
<div className="mx_LinkPreviewWidget_title"><a href={this.props.link} target="_blank" rel="noreferrer noopener">{ p["og:title"] }</a></div> <div className="mx_LinkPreviewWidget_title"><a href={this.props.link} target="_blank" rel="noreferrer noopener">{ p["og:title"] }</a></div>