Hide image banner on stickers, they have a tooltip already (#8641)

This commit is contained in:
Michael Telatynski 2022-05-18 10:08:33 +01:00 committed by GitHub
parent 65e27cd6be
commit ce73b9988e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 16 deletions

View file

@ -355,6 +355,22 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
}
}
protected getBanner(content: IMediaEventContent): JSX.Element {
// Hide it for the threads list & the file panel where we show it as text anyway.
if ([
TimelineRenderingType.ThreadsList,
TimelineRenderingType.File,
].includes(this.context.timelineRenderingType)) {
return null;
}
return (
<span className="mx_MImageBody_banner">
{ presentableTextForFile(content, _t("Image"), true, true) }
</span>
);
}
protected messageContent(
contentUrl: string,
thumbUrl: string,
@ -448,18 +464,8 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
}
let banner: JSX.Element;
const isTimeline = [
TimelineRenderingType.Room,
TimelineRenderingType.Search,
TimelineRenderingType.Thread,
TimelineRenderingType.Notification,
].includes(this.context.timelineRenderingType);
if (this.state.showImage && this.state.hover && isTimeline) {
banner = (
<span className="mx_MImageBody_banner">
{ presentableTextForFile(content, _t("Image"), true, true) }
</span>
);
if (this.state.showImage && this.state.hover) {
banner = this.getBanner(content);
}
const classes = classNames({