getAvatarForThreadEntity handles the personal thread avatars. For personal thread avatars, I should see the other user's avatar on my screen, and they should see mine. For example, in my 1on1 chat with atul, I should see atul's avatar on my screen and atul should see my avatar on his screen. To handle this behavior I looked at what we did when getting the uiName in useResolvedThreadInfo and used it as inspiration to get the correct avatar for this thread type.
The majority of this function is just making sure that the`threadEntity` argument is the correct type. Once we validate that we can grab the non viewer user in this thread, we return their user avatar. If any of these checks fail then we should return null since this is not considered a personal thread, and useGetAvatarForThread will then later make sure we give this thread a channel thread avatar.
Depends on D7132