mirror of https://github.com/vector-im/riot-web
Add a confirmation prompt when upgrading the room via slashcommand
Wording is questionable here, but the idea is to discourage non-power-users from accidentally upgrading their room. They should already be receiving a bunch of warnings if they should consider upgrading in the first place.pull/21833/head
parent
788041a774
commit
fba4b7235f
|
@ -28,6 +28,7 @@ import {MATRIXTO_URL_PATTERN} from "./linkify-matrix";
|
|||
import * as querystring from "querystring";
|
||||
import MultiInviter from './utils/MultiInviter';
|
||||
import { linkifyAndSanitizeHtml } from './HtmlUtils';
|
||||
import QuestionDialog from "./components/views/dialogs/QuestionDialog";
|
||||
|
||||
class Command {
|
||||
constructor({name, args='', description, runFn, hideCompletionAfterSpace=false}) {
|
||||
|
@ -105,7 +106,43 @@ export const CommandMap = {
|
|||
description: _td('Upgrades a room to a new version'),
|
||||
runFn: function(roomId, args) {
|
||||
if (args) {
|
||||
return success(MatrixClientPeg.get().upgradeRoom(roomId, args));
|
||||
const room = MatrixClientPeg.get().getRoom(roomId);
|
||||
Modal.createTrackedDialog('Slash Commands', 'upgrade room confirmation',
|
||||
QuestionDialog, {
|
||||
title: _t('Room upgrade confirmation'),
|
||||
description: (
|
||||
<div>
|
||||
{ _t(
|
||||
"Upgrading your room in this way can be dangerous or unnecessary. Room upgrades " +
|
||||
"are usually done to change the server's behaviour in a given room and not so much " +
|
||||
"anything to do with client (Riot) behaviour.",
|
||||
) }
|
||||
<br />
|
||||
<br />
|
||||
{ _t(
|
||||
"Members of the room will be required to click a link to join the new room. No " +
|
||||
"one will be automatically joined or invited to the new room.",
|
||||
) }
|
||||
<br />
|
||||
<br />
|
||||
{ _t(
|
||||
"Please confirm that you'd like to go forward with upgrading this room from " +
|
||||
"%(oldVersion)s to %(newVersion)s",
|
||||
{
|
||||
oldVersion: room ? room.getVersion() : "1",
|
||||
newVersion: args,
|
||||
},
|
||||
) }
|
||||
</div>
|
||||
),
|
||||
button: _t("Upgrade Room"),
|
||||
onFinished: (confirm) => {
|
||||
if (!confirm) return;
|
||||
|
||||
MatrixClientPeg.get().upgradeRoom(roomId, args);
|
||||
},
|
||||
});
|
||||
return success();
|
||||
}
|
||||
return reject(this.getUsage());
|
||||
},
|
||||
|
|
|
@ -132,6 +132,11 @@
|
|||
"/ddg is not a command": "/ddg is not a command",
|
||||
"To use it, just wait for autocomplete results to load and tab through them.": "To use it, just wait for autocomplete results to load and tab through them.",
|
||||
"Upgrades a room to a new version": "Upgrades a room to a new version",
|
||||
"Room upgrade confirmation": "Room upgrade confirmation",
|
||||
"Upgrading your room in this way can be dangerous or unnecessary. Room upgrades are usually done to change the server's behaviour in a given room and not so much anything to do with client (Riot) behaviour.": "Upgrading your room in this way can be dangerous or unnecessary. Room upgrades are usually done to change the server's behaviour in a given room and not so much anything to do with client (Riot) behaviour.",
|
||||
"Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.": "Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.",
|
||||
"Please confirm that you'd like to go forward with upgrading this room from %(oldVersion)s to %(newVersion)s": "Please confirm that you'd like to go forward with upgrading this room from %(oldVersion)s to %(newVersion)s",
|
||||
"Upgrade Room": "Upgrade Room",
|
||||
"Changes your display nickname": "Changes your display nickname",
|
||||
"Changes your display nickname in the current room only": "Changes your display nickname in the current room only",
|
||||
"Changes colour scheme of current room": "Changes colour scheme of current room",
|
||||
|
@ -581,7 +586,6 @@
|
|||
"Camera": "Camera",
|
||||
"Voice & Video": "Voice & Video",
|
||||
"This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers",
|
||||
"Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.": "Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.",
|
||||
"Upgrade room to version %(ver)s": "Upgrade room to version %(ver)s",
|
||||
"Room information": "Room information",
|
||||
"Internal room ID:": "Internal room ID:",
|
||||
|
|
Loading…
Reference in New Issue