Fetch profiles for conversations needing verification, more logging too
This commit is contained in:
parent
6856e246e2
commit
14ab7b9e0d
1 changed files with 31 additions and 0 deletions
|
@ -2,6 +2,8 @@
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
|
||||||
|
import PQueue from 'p-queue';
|
||||||
import type { ThunkAction } from 'redux-thunk';
|
import type { ThunkAction } from 'redux-thunk';
|
||||||
import {
|
import {
|
||||||
difference,
|
difference,
|
||||||
|
@ -1272,6 +1274,10 @@ function verifyConversationsStoppingSend(): ThunkAction<
|
||||||
const conversationIdsStoppingSend = getConversationIdsStoppingSend(state);
|
const conversationIdsStoppingSend = getConversationIdsStoppingSend(state);
|
||||||
const conversationIdsBlocked =
|
const conversationIdsBlocked =
|
||||||
getConversationIdsStoppedForVerification(state);
|
getConversationIdsStoppedForVerification(state);
|
||||||
|
log.info(
|
||||||
|
`verifyConversationsStoppingSend: Starting with ${conversationIdsBlocked.length} blocked ` +
|
||||||
|
`conversations and ${conversationIdsStoppingSend.length} conversations to verify.`
|
||||||
|
);
|
||||||
|
|
||||||
// Mark conversations as approved/verified as appropriate
|
// Mark conversations as approved/verified as appropriate
|
||||||
const promises: Array<Promise<unknown>> = [];
|
const promises: Array<Promise<unknown>> = [];
|
||||||
|
@ -1280,6 +1286,10 @@ function verifyConversationsStoppingSend(): ThunkAction<
|
||||||
if (!conversation) {
|
if (!conversation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info(
|
||||||
|
`verifyConversationsStoppingSend: Verifying conversation ${conversation.idForLogging()}`
|
||||||
|
);
|
||||||
if (conversation.isUnverified()) {
|
if (conversation.isUnverified()) {
|
||||||
promises.push(conversation.setVerifiedDefault());
|
promises.push(conversation.setVerifiedDefault());
|
||||||
}
|
}
|
||||||
|
@ -1495,6 +1505,27 @@ function conversationStoppedByMissingVerification(payload: {
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
untrustedConversationIds: ReadonlyArray<string>;
|
untrustedConversationIds: ReadonlyArray<string>;
|
||||||
}): ConversationStoppedByMissingVerificationActionType {
|
}): ConversationStoppedByMissingVerificationActionType {
|
||||||
|
// Fetching profiles to ensure that we have their latest identity key in storage
|
||||||
|
const profileFetchQueue = new PQueue({
|
||||||
|
concurrency: 3,
|
||||||
|
});
|
||||||
|
payload.untrustedConversationIds.forEach(untrustedConversationId => {
|
||||||
|
const conversation = window.ConversationController.get(
|
||||||
|
untrustedConversationId
|
||||||
|
);
|
||||||
|
if (!conversation) {
|
||||||
|
log.error(
|
||||||
|
`conversationStoppedByMissingVerification: conversationId ${untrustedConversationId} not found!`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
profileFetchQueue.add(() => {
|
||||||
|
const active = conversation.getActiveProfileFetch();
|
||||||
|
return active || conversation.getProfiles();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: CONVERSATION_STOPPED_BY_MISSING_VERIFICATION,
|
type: CONVERSATION_STOPPED_BY_MISSING_VERIFICATION,
|
||||||
payload,
|
payload,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue