Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 8779219

Browse files
authored
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 <[email protected]> * 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 <[email protected]> * Feedback --------- Signed-off-by: Suguru Hirahara <[email protected]>
1 parent d9d5387 commit 8779219

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/components/views/messages/EditHistoryMessage.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
129129
this.tooltipifyLinks();
130130
}
131131

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

146-
// disabled remove button when not allowed
147-
return (
148-
<div className="mx_MessageActionBar">
149-
{redactButton}
150-
{viewSourceButton}
151-
</div>
152-
);
146+
if (!redactButton && !viewSourceButton) {
147+
// Hide the empty MessageActionBar
148+
return null;
149+
} else {
150+
// disabled remove button when not allowed
151+
return (
152+
<div className="mx_MessageActionBar">
153+
{redactButton}
154+
{viewSourceButton}
155+
</div>
156+
);
157+
}
153158
}
154159

155160
public render(): React.ReactNode {

0 commit comments

Comments
 (0)