You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
strip (IRC) displayname suffix from autocomplete
Fixes vector-im/vector-web#574
This commit is contained in:
@ -11,11 +11,11 @@ let instance = null;
|
|||||||
export default class UserProvider extends AutocompleteProvider {
|
export default class UserProvider extends AutocompleteProvider {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(USER_REGEX, {
|
super(USER_REGEX, {
|
||||||
keys: ['displayName', 'userId'],
|
keys: ['name', 'userId'],
|
||||||
});
|
});
|
||||||
this.users = [];
|
this.users = [];
|
||||||
this.fuse = new Fuse([], {
|
this.fuse = new Fuse([], {
|
||||||
keys: ['displayName', 'userId'],
|
keys: ['name', 'userId'],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,12 @@ export default class UserProvider extends AutocompleteProvider {
|
|||||||
if (command) {
|
if (command) {
|
||||||
this.fuse.set(this.users);
|
this.fuse.set(this.users);
|
||||||
completions = this.fuse.search(command[0]).map(user => {
|
completions = this.fuse.search(command[0]).map(user => {
|
||||||
|
const displayName = (user.name || user.userId || '').replace(' (IRC)', ''); // FIXME when groups are done
|
||||||
return {
|
return {
|
||||||
completion: user.userId,
|
completion: user.userId,
|
||||||
component: (
|
component: (
|
||||||
<TextualCompletion
|
<TextualCompletion
|
||||||
title={user.displayName || user.userId}
|
title={displayName}
|
||||||
description={user.userId} />
|
description={user.userId} />
|
||||||
),
|
),
|
||||||
range
|
range
|
||||||
|
Reference in New Issue
Block a user