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