Skip to content

Commit

Permalink
Disable URL preview removal button (#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
dalefukami authored Oct 19, 2023
1 parent c599276 commit fdd2554
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/message/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { bemClassName } from '../../lib/bem';

import './styles.scss';
import { ParentMessage } from './parent-message';
import { featureFlags } from '../../lib/feature-flags';

const cn = bemClassName('message');

Expand Down Expand Up @@ -264,13 +265,19 @@ export class Message extends React.Component<Properties, State> {
);
}

get canRemovePreview(): boolean {
return !featureFlags.enableMatrix && this.props.isOwner;
}

renderLinkPreview() {
const { preview, isOwner, hidePreview, media, parentMessageText } = this.props;
const { preview, hidePreview, media, parentMessageText } = this.props;
if (!preview || hidePreview || media || parentMessageText) {
return;
}

return <LinkPreview url={preview.url} {...preview} allowRemove={isOwner} onRemove={this.onRemovePreview} />;
return (
<LinkPreview url={preview.url} {...preview} allowRemove={this.canRemovePreview} onRemove={this.onRemovePreview} />
);
}

renderBody() {
Expand Down

0 comments on commit fdd2554

Please sign in to comment.