mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
strip (IRC) displayname suffix from autocomplete
Fixes vector-im/vector-web#574
This commit is contained in:
parent
89d2a56584
commit
2cddf18461
1 changed files with 4 additions and 3 deletions
|
@ -11,11 +11,11 @@ let instance = null;
|
|||
export default class UserProvider extends AutocompleteProvider {
|
||||
constructor() {
|
||||
super(USER_REGEX, {
|
||||
keys: ['displayName', 'userId'],
|
||||
keys: ['name', 'userId'],
|
||||
});
|
||||
this.users = [];
|
||||
this.fuse = new Fuse([], {
|
||||
keys: ['displayName', 'userId'],
|
||||
keys: ['name', 'userId'],
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,12 @@ export default class UserProvider extends AutocompleteProvider {
|
|||
if (command) {
|
||||
this.fuse.set(this.users);
|
||||
completions = this.fuse.search(command[0]).map(user => {
|
||||
const displayName = (user.name || user.userId || '').replace(' (IRC)', ''); // FIXME when groups are done
|
||||
return {
|
||||
completion: user.userId,
|
||||
component: (
|
||||
<TextualCompletion
|
||||
title={user.displayName || user.userId}
|
||||
title={displayName}
|
||||
description={user.userId} />
|
||||
),
|
||||
range
|
||||
|
|
Loading…
Reference in a new issue