Conversation details changes for PNP
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
1a74da0c26
commit
eb82ace2de
49 changed files with 1660 additions and 699 deletions
|
@ -154,11 +154,34 @@ export const getAllSignalConnections = createSelector(
|
|||
conversations.filter(isSignalConnection)
|
||||
);
|
||||
|
||||
export const getConversationsByTitleSelector = createSelector(
|
||||
export const getSafeConversationWithSameTitle = createSelector(
|
||||
getAllConversations,
|
||||
(conversations): ((title: string) => Array<ConversationType>) =>
|
||||
(title: string) =>
|
||||
conversations.filter(conversation => conversation.title === title)
|
||||
(
|
||||
_state: StateType,
|
||||
{
|
||||
possiblyUnsafeConversation,
|
||||
}: {
|
||||
possiblyUnsafeConversation: ConversationType;
|
||||
}
|
||||
) => possiblyUnsafeConversation,
|
||||
(conversations, possiblyUnsafeConversation): ConversationType | undefined => {
|
||||
const conversationsWithSameTitle = conversations.filter(conversation => {
|
||||
return conversation.title === possiblyUnsafeConversation.title;
|
||||
});
|
||||
assertDev(
|
||||
conversationsWithSameTitle.length,
|
||||
'Expected at least 1 conversation with the same title (this one)'
|
||||
);
|
||||
|
||||
const safeConversation = conversationsWithSameTitle.find(
|
||||
otherConversation =>
|
||||
otherConversation.acceptedMessageRequest &&
|
||||
otherConversation.type === 'direct' &&
|
||||
otherConversation.id !== possiblyUnsafeConversation.id
|
||||
);
|
||||
|
||||
return safeConversation;
|
||||
}
|
||||
);
|
||||
|
||||
export const getSelectedConversationId = createSelector(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue