Allow /upgraderoom command without developer mode enabled (#30527) (#30529)

* Allow /upgraderoom command without developer mode enabled

This will make the instructions for upgrading rooms for hydra a lot
more straightforward, so maybe let's do this at least while hydra
upgrades happen.

* Update test to match

* Unused imports

(cherry picked from commit 4d3fde192d87b2335549324d6a29c2da04938b93)

Co-authored-by: David Baker <dbkr@users.noreply.github.com>
This commit is contained in:
ElementRobot 2025-08-08 18:16:38 +02:00 committed by GitHub
parent adfa43dcbb
commit 93095f99db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 9 deletions

View File

@ -148,7 +148,7 @@ export const Commands = [
command: "upgraderoom",
args: "<new_version>",
description: _td("slash_command|upgraderoom"),
isEnabled: (cli) => !isCurrentLocalRoom(cli) && SettingsStore.getValue("developerMode"),
isEnabled: (cli) => !isCurrentLocalRoom(cli),
runFn: function (cli, roomId, threadId, args) {
if (args) {
const room = cli.getRoom(roomId);

View File

@ -14,14 +14,12 @@ import { act, waitFor } from "jest-matrix-react";
import { type Command, Commands, getCommand } from "../../src/SlashCommands";
import { createTestClient } from "../test-utils";
import { LocalRoom, LOCAL_ROOM_ID_PREFIX } from "../../src/models/LocalRoom";
import SettingsStore from "../../src/settings/SettingsStore";
import { SdkContextClass } from "../../src/contexts/SDKContext";
import Modal, { type ComponentType, type IHandle } from "../../src/Modal";
import WidgetUtils from "../../src/utils/WidgetUtils";
import { WidgetType } from "../../src/widgets/WidgetType";
import { warnSelfDemote } from "../../src/components/views/right_panel/UserInfo";
import dispatcher from "../../src/dispatcher/dispatcher";
import { SettingLevel } from "../../src/settings/SettingLevel";
import QuestionDialog from "../../src/components/views/dialogs/QuestionDialog";
import ErrorDialog from "../../src/components/views/dialogs/ErrorDialog";
@ -127,12 +125,7 @@ describe("SlashCommands", () => {
setCurrentRoom();
});
it("should be disabled by default", () => {
expect(command.isEnabled(client)).toBe(false);
});
it("should be enabled for developerMode", () => {
SettingsStore.setValue("developerMode", null, SettingLevel.DEVICE, true);
it("should be enabled by default", () => {
expect(command.isEnabled(client)).toBe(true);
});
});