On Sender Key distribution message failure, don't update send status

This commit is contained in:
Scott Nonnenberg 2022-06-02 14:25:55 -07:00 committed by GitHub
parent db523f0684
commit e09d148c1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 13 deletions

View file

@ -412,18 +412,31 @@ export async function sendToGroupViaSenderKey(options: {
newToMemberUuids.length
} members: ${JSON.stringify(newToMemberUuids)}`
);
await handleMessageSend(
window.textsecure.messaging.sendSenderKeyDistributionMessage(
{
contentHint: ContentHint.RESENDABLE,
distributionId,
groupId,
identifiers: newToMemberUuids,
},
sendOptions ? { ...sendOptions, online: false } : undefined
),
{ messageIds: [], sendType: 'senderKeyDistributionMessage' }
);
try {
await handleMessageSend(
window.textsecure.messaging.sendSenderKeyDistributionMessage(
{
contentHint: ContentHint.RESENDABLE,
distributionId,
groupId,
identifiers: newToMemberUuids,
},
sendOptions ? { ...sendOptions, online: false } : undefined
),
{ messageIds: [], sendType: 'senderKeyDistributionMessage' }
);
} catch (error) {
// If we partially fail to send the sender key distribution message (SKDM), we don't
// want the successful SKDM sends to be considered an overall success.
if (error instanceof SendMessageProtoError) {
throw new SendMessageProtoError({
...error,
sendIsNotFinal: true,
});
}
throw error;
}
// Update memberDevices with new devices
const updatedMemberDevices = [...memberDevices, ...newToMemberDevices];