HomePhabricator
Diffusion Comm 343c0e15057f

[lib] Match thread types in pendingToRealizedThreadIDsSelector

Description

[lib] Match thread types in pendingToRealizedThreadIDsSelector

Summary:
This addresses ENG-9451, which was caused by D13404.

Before that diff, we would only match a pending thread ID to a realized thread if the thread type matched.

In that diff, we wanted to relax this condition a little bit so that a pending thick thread would match a realized thin thread, and vice versa.

However, we didn't consider a scenario where somebody creates a LOCAL thread and then somebody else leaves. In this case, the use of pendingThreadType(actualMemberIDs.length - 1, thickOrThin) would return a different thread type than the current thread's.

This diff replaces the usage of pendingThreadType, and brings back the old behavior of checking the realized thread type. However, we make sure to include both thin and thick thread types for each realized thread.

Depends on D13553

Test Plan:
I recreated the test case in the Linear task as follows:

  1. Create three accounts A, B, and C
  2. Make A friends with B and C
  3. Have A create a chat with B and C
  4. Have B leave the chat
  5. Have A search for C. Confirm that a pending personal thick thread appears in the results, and when it's pressed we no longer navigate to the test chat mentioned above

Reviewers: inka, tomek, kamil

Reviewed By: tomek

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

Details