allow SpotlightDialog person search on non-matrix attributes#247
Closed
4www wants to merge 2 commits into
Closed
Conversation
HarHarLinks
reviewed
Apr 20, 2023
| for (const user of [...findVisibleRoomMembers(cli, msc3946ProcessDynamicPredecessor), ...users]) { | ||
|
|
||
| const lcQuery = trimmedQuery.toLowerCase(); | ||
| const members = findVisibleRoomMembers(cli); |
There was a problem hiding this comment.
should probably keep this:
Suggested change
| const members = findVisibleRoomMembers(cli); | |
| const members = findVisibleRoomMembers(cli, msc3946ProcessDynamicPredecessor); |
HarHarLinks
reviewed
Apr 20, 2023
| user_id: "@earthling:matrix.org", | ||
| display_name: "Earth Person", | ||
| avatar_url: undefined, | ||
| location: "Earth", // this attribute could come from a matrix homeserver connected to LDAP |
There was a problem hiding this comment.
this test case is not clear: with this, searching by location would require searching for (a substring of) Earth, which is also a substring of earthling and Earth Person. That means it would also match in the current implementation. However with our change, the dialogue should be able to successfully find a user such as
user_id: "@earthling:matrix.org",
display_name: "Earth Person",
avatar_url: undefined,
location: "Mars",
with a query of Mars.
HarHarLinks
reviewed
Apr 20, 2023
Comment on lines
+472
to
+481
| const results = users.filter( | ||
| (it) => { | ||
| return ( | ||
| !searchTerm || | ||
| it.user_id.toLowerCase().includes(searchTerm) || | ||
| it.display_name?.toLowerCase().includes(searchTerm) || | ||
| it.location?.toLowerCase().includes(searchTerm) | ||
| ) | ||
| } | ||
| ); |
There was a problem hiding this comment.
it seems superfluous to not just do
Suggested change
| const results = users.filter( | |
| (it) => { | |
| return ( | |
| !searchTerm || | |
| it.user_id.toLowerCase().includes(searchTerm) || | |
| it.display_name?.toLowerCase().includes(searchTerm) || | |
| it.location?.toLowerCase().includes(searchTerm) | |
| ) | |
| } | |
| ); | |
| const results = users; |
while this illustrates how the server works, i feel it overcomplicates things without being useful in this place. unless i'm overlooking something?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up on the PR and discussion here: matrix-org#9556