HomePhabricator
Diffusion Comm 9e4fe445626b

[lib] introduce threadInfosSelectorForThreadType selector

Description

[lib] introduce threadInfosSelectorForThreadType selector

Summary:
The next step for user profiles is to select the threadInfo of the thread between the viewer and the user who's profile is being viewed. This is so we can navigate to this thread, get the relationship prompt, etc.

For user profiles there are two types of thread types we need to consider: PERSONAL (the DM thread between two users) and PRIVATE (thread with only yourself). Since these two thread types will be relevant for us, I created this selector so we could easily only grab those relevant threadInfos

Depends on D9235

Test Plan:
Ran the following code in the UserProfileBottomSheet component and confirmed I was returning the correct information

const privateThreadInfosSelector = threadInfosSelectorForThreadType(
  threadTypes.PRIVATE,
);
const privateThreadInfos = useSelector(privateThreadInfosSelector);

const personalThreadInfosSelctor = threadInfosSelectorForThreadType(
  threadTypes.PERSONAL,
);
const personalThreadInfos = useSelector(personalThreadInfosSelctor);

console.log('privateThreadInfos');
console.log(privateThreadInfos);

console.log('personalThreadInfos');
console.log(personalThreadInfos);

Screenshot 2023-09-14 at 2.04.17 PM.png (2×3 px, 1 MB)

Reviewers: atul, inka, ashoat

Reviewed By: ashoat

Subscribers: ashoat, tomek

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

Details

Provenance
ginsuAuthored on Sep 21 2023, 1:44 PM
Reviewer
ashoat
Differential Revision
D9204: [lib] introduce threadInfosSelectorForThreadType selector
Parents
rCOMM37a9f269f73e: [lib] introduce createPendingPersonalThread function
Branches
Unknown
Tags
Unknown