Iterate PR

pull/21833/head
Michael Telatynski 2021-06-22 22:01:18 +01:00
parent 5098a304c9
commit 5dc542f189
7 changed files with 37 additions and 29 deletions

View File

@ -27,7 +27,7 @@ import TabbedView, { Tab } from "../../structures/TabbedView";
import SpaceSettingsGeneralTab from '../spaces/SpaceSettingsGeneralTab'; import SpaceSettingsGeneralTab from '../spaces/SpaceSettingsGeneralTab';
import SpaceSettingsVisibilityTab from "../spaces/SpaceSettingsVisibilityTab"; import SpaceSettingsVisibilityTab from "../spaces/SpaceSettingsVisibilityTab";
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";
import {UIFeature} from "../../../settings/UIFeature"; import { UIFeature } from "../../../settings/UIFeature";
import AdvancedRoomSettingsTab from "../settings/tabs/room/AdvancedRoomSettingsTab"; import AdvancedRoomSettingsTab from "../settings/tabs/room/AdvancedRoomSettingsTab";
export enum SpaceSettingsTab { export enum SpaceSettingsTab {
@ -91,4 +91,3 @@ const SpaceSettingsDialog: React.FC<IProps> = ({ matrixClient: cli, space, onFin
}; };
export default SpaceSettingsDialog; export default SpaceSettingsDialog;

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2019, 2021 The Matrix.org Foundation C.I.C. Copyright 2019 - 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2019, 2021 The Matrix.org Foundation C.I.C. Copyright 2019 - 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -39,9 +39,13 @@ interface IState {
export default class RoomAliasField extends React.PureComponent<IProps, IState> { export default class RoomAliasField extends React.PureComponent<IProps, IState> {
private fieldRef = createRef<Field>(); private fieldRef = createRef<Field>();
public state = { constructor(props, context) {
super(props, context);
this.state = {
isValid: true, isValid: true,
}; };
}
private asFullAlias(localpart: string): string { private asFullAlias(localpart: string): string {
return `#${localpart}:${this.props.domain}`; return `#${localpart}:${this.props.domain}`;
@ -123,15 +127,15 @@ export default class RoomAliasField extends React.PureComponent<IProps, IState>
], ],
}); });
get isValid() { public get isValid() {
return this.state.isValid; return this.state.isValid;
} }
validate(options: IValidateOpts) { public validate(options: IValidateOpts) {
return this.fieldRef.current?.validate(options); return this.fieldRef.current?.validate(options);
} }
focus() { public focus() {
this.fieldRef.current?.focus(); this.fieldRef.current?.focus();
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2020, 2021 The Matrix.org Foundation C.I.C. Copyright 2020 - 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -33,9 +33,13 @@ interface IState {
@replaceableComponent("views.room_settings.RoomPublishSetting") @replaceableComponent("views.room_settings.RoomPublishSetting")
export default class RoomPublishSetting extends React.PureComponent<IProps, IState> { export default class RoomPublishSetting extends React.PureComponent<IProps, IState> {
public state = { constructor(props, context) {
super(props, context);
this.state = {
isRoomPublished: false, isRoomPublished: false,
}; };
}
private onRoomPublishChange = (e) => { private onRoomPublishChange = (e) => {
const valueBefore = this.state.isRoomPublished; const valueBefore = this.state.isRoomPublished;

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2019, 2021 The Matrix.org Foundation C.I.C. Copyright 2019 - 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,6 +15,7 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import { EventType } from 'matrix-js-sdk/src/@types/event';
import { _t } from "../../../../../languageHandler"; import { _t } from "../../../../../languageHandler";
import { MatrixClientPeg } from "../../../../../MatrixClientPeg"; import { MatrixClientPeg } from "../../../../../MatrixClientPeg";
@ -56,10 +57,10 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
// we handle lack of this object gracefully later, so don't worry about it failing here. // we handle lack of this object gracefully later, so don't worry about it failing here.
const room = MatrixClientPeg.get().getRoom(this.props.roomId); const room = MatrixClientPeg.get().getRoom(this.props.roomId);
room.getRecommendedVersion().then((v) => { room.getRecommendedVersion().then((v) => {
const tombstone = room.currentState.getStateEvents("m.room.tombstone", ""); const tombstone = room.currentState.getStateEvents(EventType.RoomTombstone, "");
const additionalStateChanges: Partial<IState> = {}; const additionalStateChanges: Partial<IState> = {};
const createEvent = room.currentState.getStateEvents("m.room.create", ""); const createEvent = room.currentState.getStateEvents(EventType.RoomCreate, "");
const predecessor = createEvent ? createEvent.getContent().predecessor : null; const predecessor = createEvent ? createEvent.getContent().predecessor : null;
if (predecessor && predecessor.room_id) { if (predecessor && predecessor.room_id) {
additionalStateChanges.oldRoomId = predecessor.room_id; additionalStateChanges.oldRoomId = predecessor.room_id;
@ -100,9 +101,9 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
const room = client.getRoom(this.props.roomId); const room = client.getRoom(this.props.roomId);
let unfederatableSection; let unfederatableSection;
const createEvent = room.currentState.getStateEvents('m.room.create', ''); const createEvent = room.currentState.getStateEvents(EventType.RoomCreate, '');
if (createEvent && createEvent.getContent()['m.federate'] === false) { if (createEvent && createEvent.getContent()['m.federate'] === false) {
unfederatableSection = <div>{_t('This room is not accessible by remote Matrix servers')}</div>; unfederatableSection = <div>{ _t('This room is not accessible by remote Matrix servers') }</div>;
} }
let roomUpgradeButton; let roomUpgradeButton;
@ -110,7 +111,7 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
roomUpgradeButton = ( roomUpgradeButton = (
<div> <div>
<p className='mx_SettingsTab_warningText'> <p className='mx_SettingsTab_warningText'>
{_t( { _t(
"<b>Warning</b>: Upgrading a room will <i>not automatically migrate room members " + "<b>Warning</b>: Upgrading a room will <i>not automatically migrate room members " +
"to the new version of the room.</i> We'll post a link to the new room in the old " + "to the new version of the room.</i> We'll post a link to the new room in the old " +
"version of the room - room members will have to click this link to join the new room.", "version of the room - room members will have to click this link to join the new room.",
@ -118,10 +119,10 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
"b": (sub) => <b>{sub}</b>, "b": (sub) => <b>{sub}</b>,
"i": (sub) => <i>{sub}</i>, "i": (sub) => <i>{sub}</i>,
}, },
)} ) }
</p> </p>
<AccessibleButton onClick={this.upgradeRoom} kind='primary'> <AccessibleButton onClick={this.upgradeRoom} kind='primary'>
{_t("Upgrade this room to the recommended room version")} { _t("Upgrade this room to the recommended room version") }
</AccessibleButton> </AccessibleButton>
</div> </div>
); );
@ -141,21 +142,21 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
return ( return (
<div className="mx_SettingsTab"> <div className="mx_SettingsTab">
<div className="mx_SettingsTab_heading">{_t("Advanced")}</div> <div className="mx_SettingsTab_heading">{ _t("Advanced") }</div>
<div className='mx_SettingsTab_section mx_SettingsTab_subsectionText'> <div className='mx_SettingsTab_section mx_SettingsTab_subsectionText'>
<span className='mx_SettingsTab_subheading'> <span className='mx_SettingsTab_subheading'>
{ room?.isSpaceRoom() ? _t("Space information") : _t("Room information") } { room?.isSpaceRoom() ? _t("Space information") : _t("Room information") }
</span> </span>
<div> <div>
<span>{_t("Internal room ID:")}</span>&nbsp; <span>{ _t("Internal room ID:") }</span>&nbsp;
{ this.props.roomId } { this.props.roomId }
</div> </div>
{ unfederatableSection } { unfederatableSection }
</div> </div>
<div className='mx_SettingsTab_section mx_SettingsTab_subsectionText'> <div className='mx_SettingsTab_section mx_SettingsTab_subsectionText'>
<span className='mx_SettingsTab_subheading'>{_t("Room version")}</span> <span className='mx_SettingsTab_subheading'>{ _t("Room version") }</span>
<div> <div>
<span>{_t("Room version:")}</span>&nbsp; <span>{ _t("Room version:") }</span>&nbsp;
{ room.getVersion() } { room.getVersion() }
</div> </div>
{ oldRoomLink } { oldRoomLink }

View File

@ -90,7 +90,7 @@ const SpaceSettingsGeneralTab = ({ matrixClient: cli, space, onFinished }: IProp
}; };
return <div className="mx_SettingsTab"> return <div className="mx_SettingsTab">
<div className="mx_SettingsTab_heading">{_t("General")}</div> <div className="mx_SettingsTab_heading">{ _t("General") }</div>
<div>{ _t("Edit settings relating to your space.") }</div> <div>{ _t("Edit settings relating to your space.") }</div>

View File

@ -137,7 +137,7 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space }: IProps) => {
} }
return <div className="mx_SettingsTab"> return <div className="mx_SettingsTab">
<div className="mx_SettingsTab_heading">{_t("Visibility")}</div> <div className="mx_SettingsTab_heading">{ _t("Visibility") }</div>
{ error && <div className="mx_SpaceRoomView_errorText">{ error }</div> } { error && <div className="mx_SpaceRoomView_errorText">{ error }</div> }