You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
change so that if someone enters invalid command with args we strict match
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -41,17 +41,14 @@ export default class CommandProvider extends AutocompleteProvider {
|
|||||||
const {command, range} = this.getCurrentCommand(query, selection);
|
const {command, range} = this.getCurrentCommand(query, selection);
|
||||||
if (!command) return [];
|
if (!command) return [];
|
||||||
|
|
||||||
let matches;
|
let matches = [];
|
||||||
if (command[0] !== command[1]) {
|
if (command[0] !== command[1]) {
|
||||||
// The input looks like a command with arguments, perform exact match
|
// The input looks like a command with arguments, perform exact match
|
||||||
const match = COMMANDS.find((o) => o.command === command[1]);
|
const match = COMMANDS.find((o) => o.command === command[1]);
|
||||||
if (match) {
|
if (match) {
|
||||||
matches = [match];
|
matches = [match];
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// If we don't yet have matches
|
|
||||||
if (!matches) {
|
|
||||||
if (query === '/') {
|
if (query === '/') {
|
||||||
// If they have just entered `/` show everything
|
// If they have just entered `/` show everything
|
||||||
matches = COMMANDS;
|
matches = COMMANDS;
|
||||||
|
|||||||
Reference in New Issue
Block a user