Consistent scheduling of sendToGroup
This commit is contained in:
parent
af387095be
commit
8d1ab9fd69
3 changed files with 62 additions and 50 deletions
|
@ -259,33 +259,37 @@ export class NormalMessageSendJobQueue extends JobQueue<NormalMessageSendJobData
|
||||||
let innerPromise: Promise<CallbackResultType>;
|
let innerPromise: Promise<CallbackResultType>;
|
||||||
if (conversationType === Message.GROUP) {
|
if (conversationType === Message.GROUP) {
|
||||||
log.info('sending group message');
|
log.info('sending group message');
|
||||||
innerPromise = window.Signal.Util.sendToGroup({
|
innerPromise = conversation.queueJob(
|
||||||
groupSendOptions: {
|
'normalMessageSendJobQueue',
|
||||||
attachments,
|
() =>
|
||||||
deletedForEveryoneTimestamp,
|
window.Signal.Util.sendToGroup({
|
||||||
expireTimer,
|
groupSendOptions: {
|
||||||
groupV1: updateRecipients(
|
attachments,
|
||||||
conversation.getGroupV1Info(),
|
deletedForEveryoneTimestamp,
|
||||||
recipientIdentifiersWithoutMe
|
expireTimer,
|
||||||
),
|
groupV1: updateRecipients(
|
||||||
groupV2: updateRecipients(
|
conversation.getGroupV1Info(),
|
||||||
conversation.getGroupV2Info(),
|
recipientIdentifiersWithoutMe
|
||||||
recipientIdentifiersWithoutMe
|
),
|
||||||
),
|
groupV2: updateRecipients(
|
||||||
messageText: body,
|
conversation.getGroupV2Info(),
|
||||||
preview,
|
recipientIdentifiersWithoutMe
|
||||||
profileKey,
|
),
|
||||||
quote,
|
messageText: body,
|
||||||
sticker,
|
preview,
|
||||||
timestamp: messageTimestamp,
|
profileKey,
|
||||||
mentions,
|
quote,
|
||||||
},
|
sticker,
|
||||||
conversation,
|
timestamp: messageTimestamp,
|
||||||
contentHint: ContentHint.RESENDABLE,
|
mentions,
|
||||||
messageId,
|
},
|
||||||
sendOptions,
|
conversation,
|
||||||
sendType: 'message',
|
contentHint: ContentHint.RESENDABLE,
|
||||||
});
|
messageId,
|
||||||
|
sendOptions,
|
||||||
|
sendType: 'message',
|
||||||
|
})
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
log.info('sending direct message');
|
log.info('sending direct message');
|
||||||
innerPromise = window.textsecure.messaging.sendMessageToIdentifier({
|
innerPromise = window.textsecure.messaging.sendMessageToIdentifier({
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ export class ConversationModel extends window.Backbone
|
||||||
online: true,
|
online: true,
|
||||||
};
|
};
|
||||||
if (isDirectConversation(this.attributes)) {
|
if (isDirectConversation(this.attributes)) {
|
||||||
handleMessageSend(
|
await handleMessageSend(
|
||||||
window.textsecure.messaging.sendMessageProtoAndWait({
|
window.textsecure.messaging.sendMessageProtoAndWait({
|
||||||
timestamp,
|
timestamp,
|
||||||
recipients: groupMembers,
|
recipients: groupMembers,
|
||||||
|
@ -1227,7 +1227,7 @@ export class ConversationModel extends window.Backbone
|
||||||
{ messageIds: [], sendType: 'typing' }
|
{ messageIds: [], sendType: 'typing' }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
handleMessageSend(
|
await handleMessageSend(
|
||||||
window.Signal.Util.sendContentMessageToGroup({
|
window.Signal.Util.sendContentMessageToGroup({
|
||||||
contentHint: ContentHint.IMPLICIT,
|
contentHint: ContentHint.IMPLICIT,
|
||||||
contentMessage,
|
contentMessage,
|
||||||
|
|
|
@ -904,14 +904,20 @@ export class CallingClass {
|
||||||
logId: `sendToGroup/groupCallUpdate/${conversationId}-${eraId}`,
|
logId: `sendToGroup/groupCallUpdate/${conversationId}-${eraId}`,
|
||||||
messageIds: [],
|
messageIds: [],
|
||||||
send: () =>
|
send: () =>
|
||||||
window.Signal.Util.sendToGroup({
|
conversation.queueJob('sendGroupCallUpdateMessage', () =>
|
||||||
groupSendOptions: { groupCallUpdate: { eraId }, groupV2, timestamp },
|
window.Signal.Util.sendToGroup({
|
||||||
conversation,
|
groupSendOptions: {
|
||||||
contentHint: ContentHint.DEFAULT,
|
groupCallUpdate: { eraId },
|
||||||
messageId: undefined,
|
groupV2,
|
||||||
sendOptions,
|
timestamp,
|
||||||
sendType: 'callingMessage',
|
},
|
||||||
}),
|
conversation,
|
||||||
|
contentHint: ContentHint.DEFAULT,
|
||||||
|
messageId: undefined,
|
||||||
|
sendOptions,
|
||||||
|
sendType: 'callingMessage',
|
||||||
|
})
|
||||||
|
),
|
||||||
sendType: 'callingMessage',
|
sendType: 'callingMessage',
|
||||||
timestamp,
|
timestamp,
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
@ -1565,19 +1571,21 @@ export class CallingClass {
|
||||||
// We "fire and forget" because sending this message is non-essential.
|
// We "fire and forget" because sending this message is non-essential.
|
||||||
// We also don't sync this message.
|
// We also don't sync this message.
|
||||||
const { ContentHint } = Proto.UnidentifiedSenderMessage.Message;
|
const { ContentHint } = Proto.UnidentifiedSenderMessage.Message;
|
||||||
await handleMessageSend(
|
await conversation.queueJob('handleSendCallMessageToGroup', async () =>
|
||||||
window.Signal.Util.sendContentMessageToGroup({
|
handleMessageSend(
|
||||||
contentHint: ContentHint.DEFAULT,
|
window.Signal.Util.sendContentMessageToGroup({
|
||||||
contentMessage,
|
contentHint: ContentHint.DEFAULT,
|
||||||
conversation,
|
contentMessage,
|
||||||
isPartialSend: false,
|
conversation,
|
||||||
messageId: undefined,
|
isPartialSend: false,
|
||||||
recipients: conversation.getRecipients(),
|
messageId: undefined,
|
||||||
sendOptions: await getSendOptions(conversation.attributes),
|
recipients: conversation.getRecipients(),
|
||||||
sendType: 'callingMessage',
|
sendOptions: await getSendOptions(conversation.attributes),
|
||||||
timestamp,
|
sendType: 'callingMessage',
|
||||||
}),
|
timestamp,
|
||||||
{ messageIds: [], sendType: 'callingMessage' }
|
}),
|
||||||
|
{ messageIds: [], sendType: 'callingMessage' }
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue