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

* 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
This commit is contained in:
David Baker
2025-08-08 16:36:41 +01:00
committed by GitHub
parent bcf755d45f
commit 4d3fde192d
2 changed files with 2 additions and 9 deletions

View File

@@ -148,7 +148,7 @@ export const Commands = [
command: "upgraderoom", command: "upgraderoom",
args: "<new_version>", args: "<new_version>",
description: _td("slash_command|upgraderoom"), description: _td("slash_command|upgraderoom"),
isEnabled: (cli) => !isCurrentLocalRoom(cli) && SettingsStore.getValue("developerMode"), isEnabled: (cli) => !isCurrentLocalRoom(cli),
runFn: function (cli, roomId, threadId, args) { runFn: function (cli, roomId, threadId, args) {
if (args) { if (args) {
const room = cli.getRoom(roomId); 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 { type Command, Commands, getCommand } from "../../src/SlashCommands";
import { createTestClient } from "../test-utils"; import { createTestClient } from "../test-utils";
import { LocalRoom, LOCAL_ROOM_ID_PREFIX } from "../../src/models/LocalRoom"; import { LocalRoom, LOCAL_ROOM_ID_PREFIX } from "../../src/models/LocalRoom";
import SettingsStore from "../../src/settings/SettingsStore";
import { SdkContextClass } from "../../src/contexts/SDKContext"; import { SdkContextClass } from "../../src/contexts/SDKContext";
import Modal, { type ComponentType, type IHandle } from "../../src/Modal"; import Modal, { type ComponentType, type IHandle } from "../../src/Modal";
import WidgetUtils from "../../src/utils/WidgetUtils"; import WidgetUtils from "../../src/utils/WidgetUtils";
import { WidgetType } from "../../src/widgets/WidgetType"; import { WidgetType } from "../../src/widgets/WidgetType";
import { warnSelfDemote } from "../../src/components/views/right_panel/UserInfo"; import { warnSelfDemote } from "../../src/components/views/right_panel/UserInfo";
import dispatcher from "../../src/dispatcher/dispatcher"; import dispatcher from "../../src/dispatcher/dispatcher";
import { SettingLevel } from "../../src/settings/SettingLevel";
import QuestionDialog from "../../src/components/views/dialogs/QuestionDialog"; import QuestionDialog from "../../src/components/views/dialogs/QuestionDialog";
import ErrorDialog from "../../src/components/views/dialogs/ErrorDialog"; import ErrorDialog from "../../src/components/views/dialogs/ErrorDialog";
@@ -127,12 +125,7 @@ describe("SlashCommands", () => {
setCurrentRoom(); setCurrentRoom();
}); });
it("should be disabled by default", () => { it("should be enabled by default", () => {
expect(command.isEnabled(client)).toBe(false);
});
it("should be enabled for developerMode", () => {
SettingsStore.setValue("developerMode", null, SettingLevel.DEVICE, true);
expect(command.isEnabled(client)).toBe(true); expect(command.isEnabled(client)).toBe(true);
}); });
}); });