diff --git a/src/SlashCommands.tsx b/src/SlashCommands.tsx index 72233e6d922..403ecf57725 100644 --- a/src/SlashCommands.tsx +++ b/src/SlashCommands.tsx @@ -1070,6 +1070,28 @@ export const Commands = [ category: CommandCategories.advanced, renderingTypes: [TimelineRenderingType.Room], }), + new Command({ + command: 'remakeolm', + description: _td('Developer command: Discards the current outbound group session and sets up new Olm sessions'), + isEnabled: () => { + return SettingsStore.getValue("developerMode"); + }, + runFn: (roomId) => { + try { + const room = MatrixClientPeg.get().getRoom(roomId); + + MatrixClientPeg.get().forceDiscardSession(roomId); + + // noinspection JSIgnoredPromiseFromCall + MatrixClientPeg.get().crypto.ensureOlmSessionsForUsers(room.getMembers().map(m => m.userId), true); + } catch (e) { + return reject(e.message); + } + return success(); + }, + category: CommandCategories.advanced, + renderingTypes: [TimelineRenderingType.Room], + }), new Command({ command: "rainbow", description: _td("Sends the given message coloured as a rainbow"), diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index bfcd6a29eb0..edf25a3b577 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -445,6 +445,7 @@ "Verified key": "Verified key", "The signing key you provided matches the signing key you received from %(userId)s's session %(deviceId)s. Session marked as verified.": "The signing key you provided matches the signing key you received from %(userId)s's session %(deviceId)s. Session marked as verified.", "Forces the current outbound group session in an encrypted room to be discarded": "Forces the current outbound group session in an encrypted room to be discarded", + "Developer command: Discards the current outbound group session and sets up new Olm sessions": "Developer command: Discards the current outbound group session and sets up new Olm sessions", "Sends the given message coloured as a rainbow": "Sends the given message coloured as a rainbow", "Sends the given emote coloured as a rainbow": "Sends the given emote coloured as a rainbow", "Displays list of commands with usages and descriptions": "Displays list of commands with usages and descriptions",