hide leave section if you aren't in the room instead of disabling
This commit is contained in:
parent
8cb4454ea3
commit
c4d4229340
1 changed files with 13 additions and 11 deletions
|
@ -90,6 +90,18 @@ export default class GeneralRoomSettingsTab extends React.Component<IProps, ISta
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let leaveSection;
|
||||||
|
if (room.getMyMembership() === "join") {
|
||||||
|
leaveSection = <>
|
||||||
|
<span className='mx_SettingsTab_subheading'>{ _t("Leave room") }</span>
|
||||||
|
<div className='mx_SettingsTab_section'>
|
||||||
|
<AccessibleButton kind='danger' onClick={this.onLeaveClick}>
|
||||||
|
{ _t('Leave room') }
|
||||||
|
</AccessibleButton>
|
||||||
|
</div>
|
||||||
|
</>;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_SettingsTab mx_GeneralRoomSettingsTab">
|
<div className="mx_SettingsTab mx_GeneralRoomSettingsTab">
|
||||||
<div className="mx_SettingsTab_heading">{ _t("General") }</div>
|
<div className="mx_SettingsTab_heading">{ _t("General") }</div>
|
||||||
|
@ -109,17 +121,7 @@ export default class GeneralRoomSettingsTab extends React.Component<IProps, ISta
|
||||||
<div className="mx_SettingsTab_heading">{ _t("Other") }</div>
|
<div className="mx_SettingsTab_heading">{ _t("Other") }</div>
|
||||||
{ flairSection }
|
{ flairSection }
|
||||||
{ urlPreviewSettings }
|
{ urlPreviewSettings }
|
||||||
|
{ leaveSection }
|
||||||
<span className='mx_SettingsTab_subheading'>{ _t("Leave room") }</span>
|
|
||||||
<div className='mx_SettingsTab_section'>
|
|
||||||
<AccessibleButton
|
|
||||||
kind='danger'
|
|
||||||
onClick={this.onLeaveClick}
|
|
||||||
disabled={room.getMyMembership() !== "join"}
|
|
||||||
>
|
|
||||||
{ _t('Leave room') }
|
|
||||||
</AccessibleButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue