-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow SpotlightDialog person search on non-matrix attributes #247
Conversation
for (const user of [...findVisibleRoomMembers(cli, msc3946ProcessDynamicPredecessor), ...users]) { | ||
|
||
const lcQuery = trimmedQuery.toLowerCase(); | ||
const members = findVisibleRoomMembers(cli); |
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.
should probably keep this:
const members = findVisibleRoomMembers(cli); | |
const members = findVisibleRoomMembers(cli, msc3946ProcessDynamicPredecessor); |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems superfluous to not just do
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?
Follow-up on the PR and discussion here: matrix-org#9556