From cf9089048038f6610f393b8afd90d3a5a2d0bb18 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 8 Aug 2025 16:36:41 +0100 Subject: [PATCH] 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 (cherry picked from commit 4d3fde192d87b2335549324d6a29c2da04938b93) --- src/SlashCommands.tsx | 2 +- test/unit-tests/SlashCommands-test.tsx | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/SlashCommands.tsx b/src/SlashCommands.tsx index ed2382c3ff8..f0d9085507b 100644 --- a/src/SlashCommands.tsx +++ b/src/SlashCommands.tsx @@ -148,7 +148,7 @@ export const Commands = [ command: "upgraderoom", args: "", 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); diff --git a/test/unit-tests/SlashCommands-test.tsx b/test/unit-tests/SlashCommands-test.tsx index 884031237ed..bf8d30c3dd7 100644 --- a/test/unit-tests/SlashCommands-test.tsx +++ b/test/unit-tests/SlashCommands-test.tsx @@ -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); }); });