Move to uuids for untrusted conversations needing verification

This commit is contained in:
Scott Nonnenberg 2022-05-31 12:46:56 -07:00 committed by GitHub
parent d3f9b656dd
commit d446aa9e6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 138 additions and 101 deletions

View file

@ -1011,13 +1011,13 @@ export const getConversationsStoppedForVerification = createSelector(
}
);
export const getConversationIdsStoppingSend = createSelector(
export const getConversationUuidsStoppingSend = createSelector(
getConversationVerificationData,
(pendingData): Array<string> => {
const result = new Set<string>();
Object.values(pendingData).forEach(item => {
if (item.type === ConversationVerificationState.PendingVerification) {
item.conversationsNeedingVerification.forEach(conversationId => {
item.uuidsNeedingVerification.forEach(conversationId => {
result.add(conversationId);
});
}
@ -1027,20 +1027,13 @@ export const getConversationIdsStoppingSend = createSelector(
);
export const getConversationsStoppingSend = createSelector(
getConversationByIdSelector,
getConversationIdsStoppingSend,
getConversationSelector,
getConversationUuidsStoppingSend,
(
conversationSelector: (id: string) => undefined | ConversationType,
conversationIds: ReadonlyArray<string>
conversationSelector: GetConversationByIdType,
uuids: ReadonlyArray<string>
): Array<ConversationType> => {
const conversations = conversationIds
.map(conversationId => conversationSelector(conversationId))
.filter(isNotNil);
if (conversationIds.length !== conversations.length) {
log.warn(
`getConversationsStoppingSend: Started with ${conversationIds.length} items, ended up with ${conversations.length}.`
);
}
const conversations = uuids.map(uuid => conversationSelector(uuid));
return sortByTitle(conversations);
}
);