avoid negatives

pull/21833/head
Michael Telatynski 2020-06-16 14:06:42 +01:00 committed by GitHub
parent 3217becce8
commit ef80a0b0b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -62,15 +62,15 @@ export function textSerialize(model: EditorModel) {
}
export function containsEmote(model: EditorModel) {
return startsWith(model, "/me ", true);
return startsWith(model, "/me ", false);
}
export function startsWith(model: EditorModel, prefix: string, caseInsensitive = false) {
export function startsWith(model: EditorModel, prefix: string, caseSensitive = true) {
const firstPart = model.parts[0];
// part type will be "plain" while editing,
// and "command" while composing a message.
let text = firstPart && firstPart.text;
if (caseInsensitive) {
if (!caseSensitive) {
prefix = prefix.toLowerCase();
text = text.toLowerCase();
}