Hide MFileBody download link for threaded messages (#7127)

Co-authored-by: Travis Ralston <travisr@matrix.org>
This commit is contained in:
Germain 2021-11-19 09:07:12 +00:00 committed by GitHub
parent 28d7a51bb9
commit e4d645e360
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,6 +35,7 @@ import classNames from 'classnames';
import { CSSTransition, SwitchTransition } from 'react-transition-group'; import { CSSTransition, SwitchTransition } from 'react-transition-group';
import { logger } from "matrix-js-sdk/src/logger"; import { logger } from "matrix-js-sdk/src/logger";
import { TileShape } from '../rooms/EventTile';
import { ImageSize, suggestedSize as suggestedImageSize } from "../../../settings/enums/ImageSize"; import { ImageSize, suggestedSize as suggestedImageSize } from "../../../settings/enums/ImageSize";
interface IState { interface IState {
@ -517,8 +518,14 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
// Overidden by MStickerBody // Overidden by MStickerBody
protected getFileBody(): string | JSX.Element { protected getFileBody(): string | JSX.Element {
if (this.props.forExport) return null; if (this.props.forExport) return null;
// We only ever need the download bar if we're appearing outside of the timeline /*
if (this.props.tileShape) { * In the room timeline or the thread context we don't need the download
* link as the message action bar will fullfil that
*/
const hasMessageActionBar = !this.props.tileShape
|| this.props.tileShape === TileShape.Thread
|| this.props.tileShape === TileShape.ThreadPanel;
if (!hasMessageActionBar) {
return <MFileBody {...this.props} showGenericPlaceholder={false} />; return <MFileBody {...this.props} showGenericPlaceholder={false} />;
} }
} }