Skip to content

Commit

Permalink
Hide empty MessageActionBar on message edit history dialog (#10447)
Browse files Browse the repository at this point in the history
* 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 247e7d2.

* 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>
  • Loading branch information
luixxiul committed May 18, 2023
1 parent d9d5387 commit 8779219
Showing 1 changed file with 13 additions and 8 deletions.
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;
} else {
// disabled remove button when not allowed
return (
<div className="mx_MessageActionBar">
{redactButton}
{viewSourceButton}
</div>
);
}
}

public render(): React.ReactNode {
Expand Down

0 comments on commit 8779219

Please sign in to comment.