mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:21:57 +03:00
Expose upgrade room permissions in room settings and fix command
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
8e799b7136
commit
f70f983c8c
3 changed files with 17 additions and 8 deletions
|
@ -139,8 +139,13 @@ export const CommandMap = {
|
|||
description: _td('Upgrades a room to a new version'),
|
||||
runFn: function(roomId, args) {
|
||||
if (args) {
|
||||
const room = MatrixClientPeg.get().getRoom(roomId);
|
||||
Modal.createTrackedDialog('Slash Commands', 'upgrade room confirmation',
|
||||
const cli = MatrixClientPeg.get();
|
||||
const room = cli.getRoom(roomId);
|
||||
if (!room.currentState.mayClientSendStateEvent("m.room.tombstone", cli)) {
|
||||
return reject(_t("You do not have the required permissions to use this command."));
|
||||
}
|
||||
|
||||
const {finished} = Modal.createTrackedDialog('Slash Commands', 'upgrade room confirmation',
|
||||
QuestionDialog, {
|
||||
title: _t('Room upgrade confirmation'),
|
||||
description: (
|
||||
|
@ -198,13 +203,13 @@ export const CommandMap = {
|
|||
</div>
|
||||
),
|
||||
button: _t("Upgrade"),
|
||||
onFinished: (confirm) => {
|
||||
if (!confirm) return;
|
||||
|
||||
MatrixClientPeg.get().upgradeRoom(roomId, args);
|
||||
},
|
||||
});
|
||||
return success();
|
||||
|
||||
return success(finished.then((confirm) => {
|
||||
if (!confirm) return;
|
||||
|
||||
return cli.upgradeRoom(roomId, args);
|
||||
}));
|
||||
}
|
||||
return reject(this.getUsage());
|
||||
},
|
||||
|
|
|
@ -30,6 +30,7 @@ const plEventsToLabels = {
|
|||
"m.room.history_visibility": _td("Change history visibility"),
|
||||
"m.room.power_levels": _td("Change permissions"),
|
||||
"m.room.topic": _td("Change topic"),
|
||||
"m.room.tombstone": _td("Upgrade the room"),
|
||||
|
||||
"im.vector.modular.widgets": _td("Modify widgets"),
|
||||
};
|
||||
|
@ -42,6 +43,7 @@ const plEventsToShow = {
|
|||
"m.room.history_visibility": {isState: true},
|
||||
"m.room.power_levels": {isState: true},
|
||||
"m.room.topic": {isState: true},
|
||||
"m.room.tombstone": {isState: true},
|
||||
|
||||
"im.vector.modular.widgets": {isState: true},
|
||||
};
|
||||
|
|
|
@ -146,6 +146,7 @@
|
|||
"/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",
|
||||
"You do not have the required permissions to use this command.": "You do not have the required permissions to use this command.",
|
||||
"Room upgrade confirmation": "Room upgrade confirmation",
|
||||
"Upgrading a room can be destructive and isn't always necessary.": "Upgrading a room can be destructive and isn't always necessary.",
|
||||
"Room upgrades are usually recommended when a room version is considered <i>unstable</i>. Unstable room versions might have bugs, missing features, or security vulnerabilities.": "Room upgrades are usually recommended when a room version is considered <i>unstable</i>. Unstable room versions might have bugs, missing features, or security vulnerabilities.",
|
||||
|
@ -680,6 +681,7 @@
|
|||
"Change history visibility": "Change history visibility",
|
||||
"Change permissions": "Change permissions",
|
||||
"Change topic": "Change topic",
|
||||
"Upgrade the room": "Upgrade the room",
|
||||
"Modify widgets": "Modify widgets",
|
||||
"Failed to unban": "Failed to unban",
|
||||
"Unban": "Unban",
|
||||
|
|
Loading…
Reference in a new issue