Add ProfileKeyForCall conversation job
Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
This commit is contained in:
parent
3aa54a3070
commit
9ba6df8ef2
3 changed files with 13 additions and 5 deletions
|
@ -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<typeof nullMessageJobDataSchema>;
|
||||
|
||||
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<ConversationQueueJobData> {
|
|||
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<ConversationQueueJobData> {
|
|||
}
|
||||
|
||||
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.`
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue