Fix changes after typing / at pos=0 allowing to cancel command

pull/21833/head
Michael Telatynski 2020-01-21 15:58:51 +00:00
parent b5e902e1f2
commit 060938379a
1 changed files with 3 additions and 2 deletions

View File

@ -180,13 +180,14 @@ export default class SendMessageComposer extends React.Component {
const parts = this.model.parts; const parts = this.model.parts;
const firstPart = parts[0]; const firstPart = parts[0];
if (firstPart) { if (firstPart) {
if (firstPart.type === "command" && !firstPart.text.startsWith("//")) { if (firstPart.type === "command" && firstPart.text.startsWith("/") && !firstPart.text.startsWith("//")) {
return true; return true;
} }
// be extra resilient when somehow the AutocompleteWrapperModel or // be extra resilient when somehow the AutocompleteWrapperModel or
// CommandPartCreator fails to insert a command part, so we don't send // CommandPartCreator fails to insert a command part, so we don't send
// a command as a message // a command as a message
if (firstPart.text.startsWith("/") && !firstPart.text.startsWith("//") && (firstPart.type === "plain" || firstPart.type === "pill-candidate")) { if (firstPart.text.startsWith("/") && firstPart.text.startsWith("//") && !firstPart.text.startsWith("//")
&& (firstPart.type === "plain" || firstPart.type === "pill-candidate")) {
return true; return true;
} }
} }