From e49c0314ccab119c2c3077c28fa18893695e429b Mon Sep 17 00:00:00 2001 From: Michael Kochell <6913320+mickmister@users.noreply.github.com> Date: Thu, 1 Apr 2021 13:45:16 -0400 Subject: [PATCH] [MM-33892] Replace em dash with double dash for commands (#5259) * replace em dash with double dash for commands * style * missing semi --- app/actions/views/command.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/actions/views/command.ts b/app/actions/views/command.ts index 882a81a7e..02cd10edd 100644 --- a/app/actions/views/command.ts +++ b/app/actions/views/command.ts @@ -30,6 +30,7 @@ export function executeCommand(message: string, channelId: string, rootId: strin }; let msg = message; + msg = filterEmDashForCommand(msg); let cmdLength = msg.indexOf(' '); if (cmdLength < 0) { @@ -43,7 +44,7 @@ export function executeCommand(message: string, channelId: string, rootId: strin if (appsAreEnabled) { const parser = new AppCommandParser({dispatch, getState}, intl, args.channel_id, args.root_id); if (parser.isAppCommand(msg)) { - const {call, errorMessage} = await parser.composeCallFromCommand(message); + const {call, errorMessage} = await parser.composeCallFromCommand(msg); const createErrorMessage = (errMessage: string) => { return {error: {message: errMessage}}; }; @@ -90,3 +91,7 @@ export function executeCommand(message: string, channelId: string, rootId: strin return {data, error}; }; } + +const filterEmDashForCommand = (command: string): string => { + return command.replace(/\u2014/g, '--'); +};