[Flow202][lib][skip-ci] [12/23] Fix Flow issues with search-utils.js
Summary:
Separating this out into its own diff since I made some opinionated changes that I think improve readability.
The Flow issues here were in two categories:
- GlobalAccountUserInfo doesn't have a relationshipStatus property, so Flow wanted us to check for that property's existence before using it. I made this change, and restructured some of the surrounding code to make it more readable.
- filterChatMessageInfosForSearch was calling Map.get on a map keyed by string, where the param was ?string. Flow wants us to check the param before passing it to Map.get. I took this opportunity to clean up some of the code in filterChatMessageInfosForSearch to make it more readable.
NOTE: CI will fail on this diff. I considered the possibility of fixing Flow errors BEFORE upgrading Flow, but it wasn't possible... in some cases, the fixes to support the new version of Flow caused errors in the old version. I could have hidden these type errors with $FlowFixMe lines and then later revert those, but that seemed like too much busy work.
Depends on D9703
Test Plan: Confirm the Flow errors go away
Reviewers: inka
Reviewed By: inka
Subscribers: tomek, wyilio
Differential Revision: https://phab.comm.dev/D9704