Conversation details changes for PNP

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Fedor Indutny 2024-02-05 18:13:13 -08:00 committed by GitHub
parent 1a74da0c26
commit eb82ace2de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 1660 additions and 699 deletions

View file

@ -29,7 +29,7 @@ import {
getContactNameColorSelector,
getConversationByIdSelector,
getConversationServiceIdsStoppingSend,
getConversationsByTitleSelector,
getSafeConversationWithSameTitle,
getConversationSelector,
getConversationsStoppingSend,
getFilteredCandidateContactsForNewGroup,
@ -1577,32 +1577,32 @@ describe('both/state/selectors/conversations-extra', () => {
});
});
describe('#getConversationsByTitleSelector', () => {
describe('#getSafeConversationWithSameTitle', () => {
it('returns a selector that finds conversations by title', () => {
const unsafe = { ...makeConversation('abc'), title: 'Janet' };
const safe = { ...makeConversation('def'), title: 'Janet' };
const unique = { ...makeConversation('geh'), title: 'Rick' };
const state = {
...getEmptyRootState(),
conversations: {
...getEmptyState(),
conversationLookup: {
abc: { ...makeConversation('abc'), title: 'Janet' },
def: { ...makeConversation('def'), title: 'Janet' },
geh: { ...makeConversation('geh'), title: 'Rick' },
abc: unsafe,
def: safe,
geh: unique,
},
},
};
const selector = getConversationsByTitleSelector(state);
const janet = getSafeConversationWithSameTitle(state, {
possiblyUnsafeConversation: unsafe,
});
assert.strictEqual(janet, safe);
assert.sameMembers(
selector('Janet').map(c => c.id),
['abc', 'def']
);
assert.sameMembers(
selector('Rick').map(c => c.id),
['geh']
);
assert.isEmpty(selector('abc'));
assert.isEmpty(selector('xyz'));
const rick = getSafeConversationWithSameTitle(state, {
possiblyUnsafeConversation: unique,
});
assert.strictEqual(rick, undefined);
});
});