Merge pull request #6920 from matrix-org/t3chguy/fix/17410
This commit is contained in:
commit
a37c10b256
1 changed files with 17 additions and 10 deletions
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React, { ContextType } from 'react';
|
||||||
import { _t } from "../../../../../languageHandler";
|
import { _t } from "../../../../../languageHandler";
|
||||||
import RoomProfileSettings from "../../../room_settings/RoomProfileSettings";
|
import RoomProfileSettings from "../../../room_settings/RoomProfileSettings";
|
||||||
import AccessibleButton from "../../../elements/AccessibleButton";
|
import AccessibleButton from "../../../elements/AccessibleButton";
|
||||||
|
@ -38,9 +38,10 @@ interface IState {
|
||||||
@replaceableComponent("views.settings.tabs.room.GeneralRoomSettingsTab")
|
@replaceableComponent("views.settings.tabs.room.GeneralRoomSettingsTab")
|
||||||
export default class GeneralRoomSettingsTab extends React.Component<IProps, IState> {
|
export default class GeneralRoomSettingsTab extends React.Component<IProps, IState> {
|
||||||
public static contextType = MatrixClientContext;
|
public static contextType = MatrixClientContext;
|
||||||
|
context: ContextType<typeof MatrixClientContext>;
|
||||||
|
|
||||||
constructor(props: IProps) {
|
constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
|
||||||
super(props);
|
super(props, context);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
isRoomPublished: false, // loaded async
|
isRoomPublished: false, // loaded async
|
||||||
|
@ -89,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>
|
||||||
|
@ -108,13 +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}>
|
|
||||||
{ _t('Leave room') }
|
|
||||||
</AccessibleButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue