diff --git a/ts/jobs/conversationJobQueue.ts b/ts/jobs/conversationJobQueue.ts index 67decfe4c347..ddd7c24b00db 100644 --- a/ts/jobs/conversationJobQueue.ts +++ b/ts/jobs/conversationJobQueue.ts @@ -64,6 +64,7 @@ export const conversationQueueJobEnum = z.enum([ 'NormalMessage', 'NullMessage', 'ProfileKey', + 'ProfileKeyForCall', 'Reaction', 'ResendRequest', 'SavedProto', @@ -165,7 +166,10 @@ const nullMessageJobDataSchema = z.object({ export type NullMessageJobData = z.infer; const profileKeyJobDataSchema = z.object({ - type: z.literal(conversationQueueJobEnum.enum.ProfileKey), + type: z.union([ + z.literal(conversationQueueJobEnum.enum.ProfileKey), + z.literal(conversationQueueJobEnum.enum.ProfileKeyForCall), + ]), conversationId: z.string(), // Note: we will use whichever recipients list is up to date when this job runs revision: z.number().optional(), @@ -297,6 +301,9 @@ function shouldSendShowCaptcha(type: ConversationQueueJobEnum): boolean { if (type === 'ProfileKey') { return false; } + if (type === 'ProfileKeyForCall') { + return true; + } if (type === 'Reaction') { return false; } @@ -946,6 +953,7 @@ export class ConversationJobQueue extends JobQueue { await sendNullMessage(conversation, jobBundle, data); break; case jobSet.ProfileKey: + case jobSet.ProfileKeyForCall: await sendProfileKey(conversation, jobBundle, data); break; case jobSet.Reaction: @@ -1042,7 +1050,7 @@ export class ConversationJobQueue extends JobQueue { } if (untrustedServiceIds.length) { - if (type === jobSet.ProfileKey) { + if (type === jobSet.ProfileKey || type === jobSet.ProfileKeyForCall) { log.warn( `Cancelling profile share, since there were ${untrustedServiceIds.length} untrusted send targets.` ); diff --git a/ts/jobs/helpers/sendProfileKey.ts b/ts/jobs/helpers/sendProfileKey.ts index 38434800fe92..2464e1381b13 100644 --- a/ts/jobs/helpers/sendProfileKey.ts +++ b/ts/jobs/helpers/sendProfileKey.ts @@ -90,7 +90,7 @@ export async function sendProfileKey( } log.info( - `starting profile key share to ${conversation.idForLogging()} with timestamp ${timestamp}` + `starting profile key share to ${conversation.idForLogging()} with timestamp ${timestamp} type=${data.type}` ); const { revision } = data; diff --git a/ts/services/calling.ts b/ts/services/calling.ts index 782c121fd1e4..123599fc2a8c 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -926,7 +926,7 @@ export class CallingClass { log.info(`${logId}: Sending profile key`); await conversationJobQueue.add({ conversationId: conversation.id, - type: 'ProfileKey', + type: 'ProfileKeyForCall', }); RingRTC.setOutgoingAudio(call.callId, hasLocalAudio); @@ -1544,7 +1544,7 @@ export class CallingClass { log.info(`${logId}: Sending profile key`); drop( conversationJobQueue.add({ - type: conversationQueueJobEnum.enum.ProfileKey, + type: conversationQueueJobEnum.enum.ProfileKeyForCall, conversationId: conversation.id, isOneTimeSend: true, })