Page MenuHomePhabricator

[lib] Don't include keyserver admin in useThreadSearchIndex
ClosedPublic

Authored by ashoat on May 30 2024, 9:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 10, 10:25 PM
Unknown Object (File)
Thu, Oct 10, 10:25 PM
Unknown Object (File)
Thu, Oct 10, 10:25 PM
Unknown Object (File)
Thu, Oct 10, 10:24 PM
Unknown Object (File)
Sep 9 2024, 9:29 AM
Unknown Object (File)
Sep 9 2024, 9:29 AM
Unknown Object (File)
Sep 9 2024, 9:28 AM
Unknown Object (File)
Sep 9 2024, 9:28 AM
Subscribers

Details

Summary

While working on ENG-8292, I learned that my username is included for every single thread in GENESIS. That means if you type in my name in ThreadPickerModal, nothing at all is filtered.

useThreadSearchIndex is used in several places, so I did a more thorough analysis:

  1. useThreadListSearch, which is used for the search bar that appears over the thread list on the home page. However in this case, the results are passed through getThreadListSearchResults, which reorders them for relevancy. So the impact is not as bad.
  2. useSearchSubchannels and useSearchSidebars, which are used in SubchannelsListModal and SidebarListModal on native. In this case we're using ThreadInfos instead of RawThreadInfos, and threadInfoFromRawThreadInfo filters out members without roles by calling getRelativeMemberInfos, which filters them here. This means the keyserver admin is never included unless they are actually listed as a member of the thread.
  3. useFilteredChildThreads, which is used in SidebarsModal and SubchannelsModal on web. Similar case as above: we use ThreadInfos, so there is no problem.
  4. Finally, the case in the Linear task: ThreadPickerModal on both native and web. We use RawThreadInfos here, and do not sort the results after we received them.

This diff makes it so we don't include the keyserver admin's username as a match for every channel in ThreadPickerModal or in useThreadListSearch. The other two are not affected since they use ThreadInfo instead of RawThreadInfo.

Test Plan

I tested by connecting my local simulator to the prod keyserver, logging in as a test user, and confirming that when I searched for "ashoat" in the ThreadPickerModal, the results were filtered to only includes chats where that user has a role

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable