retain pre-stripped text so it can be used for rendering

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2018-06-23 02:12:01 +01:00
parent 54bccd2016
commit 7cdc91856b
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E
2 changed files with 6 additions and 4 deletions

View File

@ -45,7 +45,7 @@ export default class RoomProvider extends AutocompleteProvider {
constructor() { constructor() {
super(ROOM_REGEX); super(ROOM_REGEX);
this.matcher = new FuzzyMatcher([], { this.matcher = new FuzzyMatcher([], {
keys: ['displayedAlias', 'name'], keys: ['displayedAlias', '_name'],
}); });
} }
@ -69,6 +69,7 @@ export default class RoomProvider extends AutocompleteProvider {
return { return {
room: room, room: room,
name: room.name, name: room.name,
_name: stripDiacritics(room.name),
displayedAlias: getDisplayAliasForRoom(room), displayedAlias: getDisplayAliasForRoom(room),
}; };
})); }));

View File

@ -40,11 +40,11 @@ export default class UserProvider extends AutocompleteProvider {
constructor(room: Room) { constructor(room: Room) {
super(USER_REGEX, { super(USER_REGEX, {
keys: ['name'], keys: ['_name'],
}); });
this.room = room; this.room = room;
this.matcher = new FuzzyMatcher([], { this.matcher = new FuzzyMatcher([], {
keys: ['name', 'userId'], keys: ['_name', 'userId'],
shouldMatchPrefix: true, shouldMatchPrefix: true,
shouldMatchWordsOnly: false, shouldMatchWordsOnly: false,
}); });
@ -149,7 +149,8 @@ export default class UserProvider extends AutocompleteProvider {
if (userId === currentUserId) return; // skip self if (userId === currentUserId) return; // skip self
this.users.push({ this.users.push({
userId, userId,
name: stripDiacritics(name), name,
_name: stripDiacritics(name),
...rest, ...rest,
}); });
}); });