[MM-33892] Replace em dash with double dash for commands (#5259)

* replace em dash with double dash for commands

* style

* missing semi
This commit is contained in:
Michael Kochell 2021-04-01 13:45:16 -04:00 committed by GitHub
parent d898286ec9
commit e49c0314cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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, '--');
};