HomePhabricator
Diffusion Comm a5124ef49dfd

[lib] Don't include keyserver admin in useThreadSearchIndex

Description

[lib] Don't include keyserver admin in useThreadSearchIndex

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

Reviewers: inka

Reviewed By: inka

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D12250

Details

Provenance
ashoatAuthored on May 30 2024, 7:52 AM
Reviewer
inka
Differential Revision
D12250: [lib] Don't include keyserver admin in useThreadSearchIndex
Parents
rCOMMa20d55f89af6: [native] Clean up Entry delete action
Branches
Unknown
Tags
Unknown