Merge pull request #1848 from matrix-org/luke/fix-autocomplete-user-provider-at-query

Don't autocomplete users for single "@"
pull/21833/head
David Baker 2018-04-24 15:08:37 +01:00 committed by GitHub
commit f41d897b9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -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