From a3c407992be4d56e176de24acfc9378a1c96ec10 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 24 Apr 2018 13:59:18 +0100 Subject: [PATCH] Don't autocomplete users for single "@" --- src/autocomplete/UserProvider.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index e636f95751..ce8f1020a1 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -101,8 +101,13 @@ export default class UserProvider extends AutocompleteProvider { let completions = []; const {command, range} = this.getCurrentCommand(query, selection, force); - if (command) { - completions = this.matcher.match(command[0]).map((user) => { + + if (!command) return completions; + + const fullMatch = command[0]; + // Don't search if the query is a single "@" + if (fullMatch && fullMatch !== '@') { + completions = this.matcher.match(fullMatch).map((user) => { const displayName = (user.name || user.userId || '').replace(' (IRC)', ''); // FIXME when groups are done return { // Length of completion should equal length of text in decorator. draft-js