Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -14,16 +14,16 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
|
||||
import Modal from '../../../Modal';
|
||||
import { _t } from '../../../languageHandler';
|
||||
import Modal from "../../../Modal";
|
||||
import { _t } from "../../../languageHandler";
|
||||
import { upgradeRoom } from "../../../utils/RoomUpgrade";
|
||||
import { IDialogProps } from "./IDialogProps";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
import ErrorDialog from './ErrorDialog';
|
||||
import DialogButtons from '../elements/DialogButtons';
|
||||
import ErrorDialog from "./ErrorDialog";
|
||||
import DialogButtons from "../elements/DialogButtons";
|
||||
import Spinner from "../elements/Spinner";
|
||||
|
||||
interface IProps extends IDialogProps {
|
||||
|
@ -53,16 +53,19 @@ export default class RoomUpgradeDialog extends React.Component<IProps, IState> {
|
|||
|
||||
private onUpgradeClick = (): void => {
|
||||
this.setState({ busy: true });
|
||||
upgradeRoom(this.props.room, this.targetVersion, false, false).then(() => {
|
||||
this.props.onFinished(true);
|
||||
}).catch((err) => {
|
||||
Modal.createDialog(ErrorDialog, {
|
||||
title: _t("Failed to upgrade room"),
|
||||
description: ((err && err.message) ? err.message : _t("The room upgrade could not be completed")),
|
||||
upgradeRoom(this.props.room, this.targetVersion, false, false)
|
||||
.then(() => {
|
||||
this.props.onFinished(true);
|
||||
})
|
||||
.catch((err) => {
|
||||
Modal.createDialog(ErrorDialog, {
|
||||
title: _t("Failed to upgrade room"),
|
||||
description: err && err.message ? err.message : _t("The room upgrade could not be completed"),
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
this.setState({ busy: false });
|
||||
});
|
||||
}).finally(() => {
|
||||
this.setState({ busy: false });
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
|
@ -70,13 +73,15 @@ export default class RoomUpgradeDialog extends React.Component<IProps, IState> {
|
|||
if (this.state.busy) {
|
||||
buttons = <Spinner />;
|
||||
} else {
|
||||
buttons = <DialogButtons
|
||||
primaryButton={_t('Upgrade this room to version %(version)s', { version: this.targetVersion })}
|
||||
primaryButtonClass="danger"
|
||||
hasCancel={true}
|
||||
onPrimaryButtonClick={this.onUpgradeClick}
|
||||
onCancel={this.onCancelClick}
|
||||
/>;
|
||||
buttons = (
|
||||
<DialogButtons
|
||||
primaryButton={_t("Upgrade this room to version %(version)s", { version: this.targetVersion })}
|
||||
primaryButtonClass="danger"
|
||||
hasCancel={true}
|
||||
onPrimaryButtonClick={this.onUpgradeClick}
|
||||
onCancel={this.onCancelClick}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -84,25 +89,33 @@ export default class RoomUpgradeDialog extends React.Component<IProps, IState> {
|
|||
className="mx_RoomUpgradeDialog"
|
||||
onFinished={this.props.onFinished}
|
||||
title={_t("Upgrade Room Version")}
|
||||
contentId='mx_Dialog_content'
|
||||
contentId="mx_Dialog_content"
|
||||
hasCancel={true}
|
||||
>
|
||||
<p>
|
||||
{ _t(
|
||||
{_t(
|
||||
"Upgrading this room requires closing down the current " +
|
||||
"instance of the room and creating a new room in its place. " +
|
||||
"To give room members the best possible experience, we will:",
|
||||
) }
|
||||
"instance of the room and creating a new room in its place. " +
|
||||
"To give room members the best possible experience, we will:",
|
||||
)}
|
||||
</p>
|
||||
<ol>
|
||||
<li>{ _t("Create a new room with the same name, description and avatar") }</li>
|
||||
<li>{ _t("Update any local room aliases to point to the new room") }</li>
|
||||
<li>{ _t("Stop users from speaking in the old version of the room, " +
|
||||
"and post a message advising users to move to the new room") }</li>
|
||||
<li>{ _t("Put a link back to the old room at the start of the new room " +
|
||||
"so people can see old messages") }</li>
|
||||
<li>{_t("Create a new room with the same name, description and avatar")}</li>
|
||||
<li>{_t("Update any local room aliases to point to the new room")}</li>
|
||||
<li>
|
||||
{_t(
|
||||
"Stop users from speaking in the old version of the room, " +
|
||||
"and post a message advising users to move to the new room",
|
||||
)}
|
||||
</li>
|
||||
<li>
|
||||
{_t(
|
||||
"Put a link back to the old room at the start of the new room " +
|
||||
"so people can see old messages",
|
||||
)}
|
||||
</li>
|
||||
</ol>
|
||||
{ buttons }
|
||||
{buttons}
|
||||
</BaseDialog>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue