-
-
Notifications
You must be signed in to change notification settings - Fork 828
Conversation
This has been commented out for ages. Just remove it and make things use QueryMatcher directly rather than looking like they do fuzzy matching but not.
This rewrites quite a lot of QueryMatcher. * Remove FuzzyMatcher which was a whole file of commented out code that just deferred to QueryMatcher * Simplify & remove some cruft from QueryMatcher, eg. most of the KeyMap stuff was completely unused. * Don't rely on object iteration order, which fixes a bug where users whose display names were entirely numeric would always appear first... * Add options.funcs to QueryMatcher to allow for indexing by things other than keys on the objects * Use above to index users by username minus the leading '@' * Don't include the '@' in the query when autocomple is triggered by typing '@'. Fixes element-hq/element-web#6782
Which 1) has a fairly complex interface with lots of subtleties and 2) is really trivial to unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than the question about localparts, I think this is sane.
this.matcher = new FuzzyMatcher([], { | ||
keys: ['name', 'userId'], | ||
this.matcher = new QueryMatcher([], { | ||
keys: ['name'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we not want to keep userId
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or something to match the localpart, at least
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's done below with a function to chop off the leading '@'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried it out, works beautifully. Happy this is finally fixed!
This rewrites quite a lot of QueryMatcher.
Fixes element-hq/element-web#6782