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

View file

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