From 0c5a8f8adb8c65e046188036a8fb42590eda0593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 13 Jan 2021 15:30:09 +0100 Subject: [PATCH 1/2] Added commands for DM conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/SlashCommands.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/SlashCommands.tsx b/src/SlashCommands.tsx index 79c21c4af5..a39ad33b04 100644 --- a/src/SlashCommands.tsx +++ b/src/SlashCommands.tsx @@ -48,6 +48,7 @@ import SettingsStore from "./settings/SettingsStore"; import {UIFeature} from "./settings/UIFeature"; import {CHAT_EFFECTS} from "./effects" import CallHandler from "./CallHandler"; +import {guessAndSetDMRoom} from "./Rooms"; // XXX: workaround for https://github.com/microsoft/TypeScript/issues/31816 interface HTMLInputEvent extends Event { @@ -1112,6 +1113,24 @@ export const Commands = [ return success(); }, }), + new Command({ + command: "converttodm", + description: _td("Converts the room to a DM"), + category: CommandCategories.other, + runFn: function(roomId, args) { + const room = MatrixClientPeg.get().getRoom(roomId); + return success(guessAndSetDMRoom(room, true)); + }, + }), + new Command({ + command: "converttoroom", + description: _td("Converts the DM to a room"), + category: CommandCategories.other, + runFn: function(roomId, args) { + const room = MatrixClientPeg.get().getRoom(roomId); + return success(guessAndSetDMRoom(room, false)); + }, + }), // Command definitions for autocompletion ONLY: // /me is special because its not handled by SlashCommands.js and is instead done inside the Composer classes From 948279ee9c58bd9b355f2b3b66b00f28b3d0cc29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 13 Jan 2021 15:32:52 +0100 Subject: [PATCH 2/2] i18n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/i18n/strings/en_EN.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index ac18ccb23e..e7604e1025 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -474,6 +474,8 @@ "Sends a message to the given user": "Sends a message to the given user", "Places the call in the current room on hold": "Places the call in the current room on hold", "Takes the call in the current room off hold": "Takes the call in the current room off hold", + "Converts the room to a DM": "Converts the room to a DM", + "Converts the DM to a room": "Converts the DM to a room", "Displays action": "Displays action", "Reason": "Reason", "%(targetName)s accepted the invitation for %(displayName)s.": "%(targetName)s accepted the invitation for %(displayName)s.",