Don't show info if no event

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-02-24 18:24:44 +01:00
parent 83e1a7a707
commit fa9ae89b5b
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
1 changed files with 25 additions and 11 deletions

View File

@ -245,6 +245,30 @@ export default class ImageView extends React.Component {
const event = this.props.mxEvent;
let info;
if (event) {
info = (
<div className="mx_ImageView_info_wrapper">
<MemberAvatar
member={event.sender}
width={32} height={32}
viewUserOnClick={true}
/>
<div className="mx_ImageView_info">
{ event.sender ? event.sender.name : event.getSender() }
{ metadata }
</div>
</div>
);
} else {
// If there is no event - we're viewing an avatar, we set
// an empty div here, since the panel uses space-between
// and we want the same placement of elements
info = (
<div></div>
);
}
return (
<FocusLock
returnFocus={true}
@ -257,17 +281,7 @@ export default class ImageView extends React.Component {
>
<div className="mx_ImageView_content">
<div className="mx_ImageView_panel" onClick={this.onPanelClick}>
<div className="mx_ImageView_info_wrapper">
<MemberAvatar
member={event.sender}
width={32} height={32}
viewUserOnClick={true}
/>
<div className="mx_ImageView_info">
{ event.sender ? event.sender.name : event.getSender() }
{ metadata }
</div>
</div>
{info}
<div className="mx_ImageView_toolbar">
<div className="mx_ImageView_toolbar_buttons">
<AccessibleTooltipButton