Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1848 from matrix-org/luke/fix-autocomplete-user-p…
Browse files Browse the repository at this point in the history
…rovider-at-query

Don't autocomplete users for single "@"
  • Loading branch information
dbkr authored Apr 24, 2018
2 parents 44bc601 + a3c4079 commit f41d897
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/autocomplete/UserProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f41d897

Please sign in to comment.