Keep draft in composer when a slash command syntax errors (#8811)

This commit is contained in:
Michael Telatynski 2022-06-10 17:16:31 +01:00 committed by GitHub
parent 4171c008a4
commit 3f99f594de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 13 deletions

View file

@ -332,13 +332,14 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
const [cmd, args, commandText] = getSlashCommand(this.model);
if (cmd) {
const threadId = editedEvent?.getThread()?.id || null;
const [content, commandSuccessful] = await runSlashCommand(cmd, args, roomId, threadId);
if (!commandSuccessful) {
return; // errored
}
if (cmd.category === CommandCategories.messages) {
editContent["m.new_content"] = await runSlashCommand(cmd, args, roomId, threadId);
if (!editContent["m.new_content"]) {
return; // errored
}
editContent["m.new_content"] = content;
} else {
runSlashCommand(cmd, args, roomId, threadId);
shouldSend = false;
}
} else if (!await shouldSendAnyway(commandText)) {