Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide empty MessageActionBar on message edit history dialog #10447

Merged
merged 6 commits into from
May 18, 2023
Merged
21 changes: 13 additions & 8 deletions src/components/views/messages/EditHistoryMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
this.tooltipifyLinks();
}

private renderActionBar(): JSX.Element {
private renderActionBar(): React.ReactNode {
// hide the button when already redacted
let redactButton: JSX.Element | undefined;
if (!this.props.mxEvent.isRedacted() && !this.props.isBaseEvent && this.state.canRedact) {
Expand All @@ -143,13 +143,18 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
);
}

// disabled remove button when not allowed
return (
<div className="mx_MessageActionBar">
{redactButton}
{viewSourceButton}
</div>
);
if (!redactButton && !viewSourceButton) {
// Hide the empty MessageActionBar
return null;
robintown marked this conversation as resolved.
Show resolved Hide resolved
} else {
// disabled remove button when not allowed
return (
<div className="mx_MessageActionBar">
{redactButton}
{viewSourceButton}
</div>
);
}
}

public render(): React.ReactNode {
Expand Down
Loading