Hide empty `MessageActionBar` on message edit history dialog (#10447)

* Hide MessageActionBar on message edit history dialog if neither redact nor view source button is rendered inside it

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

* Revert "Hide MessageActionBar on message edit history dialog if neither redact nor view source button is rendered inside it"

This reverts commit 247e7d2c8f3a5e2979c93f6a8c31d47d540cc186.

* Iterate - Hide MessageActionBar on message edit history dialog if neither redact nor view source button is rendered inside it

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

* Feedback

---------

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
t3chguy/dedup-icons-17oct
Suguru Hirahara 2023-05-18 04:17:05 +00:00 committed by GitHub
parent d9d53870e3
commit 8779219727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 8 deletions

View File

@ -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) {
@ -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;
} else {
// disabled remove button when not allowed
return (
<div className="mx_MessageActionBar">
{redactButton}
{viewSourceButton}
</div>
);
}
}
public render(): React.ReactNode {