diff --git a/ts/jobs/helpers/sendDeleteStoryForEveryone.ts b/ts/jobs/helpers/sendDeleteStoryForEveryone.ts index f8f9a0677..f4938eddb 100644 --- a/ts/jobs/helpers/sendDeleteStoryForEveryone.ts +++ b/ts/jobs/helpers/sendDeleteStoryForEveryone.ts @@ -198,6 +198,8 @@ export async function sendDeleteStoryForEveryone( didSuccessfullySendOne = true; await updateMessageWithSuccessfulSends(message, { + dataMessage: undefined, + editMessage: undefined, successfulIdentifiers: [conversation.id], }); } catch (error: unknown) { diff --git a/ts/test-electron/models/messages_test.ts b/ts/test-electron/models/messages_test.ts index 81273d6bb..efc729f2e 100644 --- a/ts/test-electron/models/messages_test.ts +++ b/ts/test-electron/models/messages_test.ts @@ -158,6 +158,7 @@ describe('Message', () => { }), ], dataMessage: fakeDataMessage, + editMessage: undefined, }); await message.send(promise); diff --git a/ts/test-electron/util/sendToGroup_test.ts b/ts/test-electron/util/sendToGroup_test.ts index 4cca28172..6d4a99a80 100644 --- a/ts/test-electron/util/sendToGroup_test.ts +++ b/ts/test-electron/util/sendToGroup_test.ts @@ -315,7 +315,10 @@ describe('sendToGroup', () => { it('returns true for errors inside of SendMessageProtoError', () => { assert.isTrue( _shouldFailSend( - new SendMessageProtoError({}), + new SendMessageProtoError({ + dataMessage: undefined, + editMessage: undefined, + }), 'testing missing errors list' ) ); @@ -326,7 +329,11 @@ describe('sendToGroup', () => { assert.isTrue( _shouldFailSend( - new SendMessageProtoError({ errors: [error] }), + new SendMessageProtoError({ + dataMessage: undefined, + editMessage: undefined, + errors: [error], + }), 'testing one error with code' ) ); @@ -334,6 +341,8 @@ describe('sendToGroup', () => { assert.isTrue( _shouldFailSend( new SendMessageProtoError({ + dataMessage: undefined, + editMessage: undefined, errors: [ new Error('something'), new ConnectTimeoutError('something'), diff --git a/ts/test-node/jobs/helpers/handleMultipleSendErrors_test.ts b/ts/test-node/jobs/helpers/handleMultipleSendErrors_test.ts index 0f78cedfe..a3e3f79e4 100644 --- a/ts/test-node/jobs/helpers/handleMultipleSendErrors_test.ts +++ b/ts/test-node/jobs/helpers/handleMultipleSendErrors_test.ts @@ -22,13 +22,20 @@ describe('maybeExpandErrors', () => { }); it('wraps the provided value if a SendMessageProtoError with no errors', () => { - const input = new SendMessageProtoError({}); + const input = new SendMessageProtoError({ + dataMessage: undefined, + editMessage: undefined, + }); assert.sameMembers(expand(input), [input]); }); it("uses a SendMessageProtoError's errors", () => { const errors = [new Error('one'), new Error('two')]; - const input = new SendMessageProtoError({ errors }); + const input = new SendMessageProtoError({ + dataMessage: undefined, + editMessage: undefined, + errors, + }); assert.strictEqual(expand(input), errors); }); }); diff --git a/ts/textsecure/Errors.ts b/ts/textsecure/Errors.ts index a581b508a..88e1ddf27 100644 --- a/ts/textsecure/Errors.ts +++ b/ts/textsecure/Errors.ts @@ -199,7 +199,9 @@ export class SendMessageProtoError extends Error implements CallbackResultType { public readonly unidentifiedDeliveries?: Array; - public readonly dataMessage?: Uint8Array; + public readonly dataMessage: Uint8Array | undefined; + + public readonly editMessage: Uint8Array | undefined; // Fields necessary for send log save public readonly contentHint?: number; @@ -218,6 +220,7 @@ export class SendMessageProtoError extends Error implements CallbackResultType { errors, unidentifiedDeliveries, dataMessage, + editMessage, contentHint, contentProto, timestamp, @@ -231,6 +234,7 @@ export class SendMessageProtoError extends Error implements CallbackResultType { this.errors = errors; this.unidentifiedDeliveries = unidentifiedDeliveries; this.dataMessage = dataMessage; + this.editMessage = editMessage; this.contentHint = contentHint; this.contentProto = contentProto; this.timestamp = timestamp; diff --git a/ts/textsecure/SendMessage.ts b/ts/textsecure/SendMessage.ts index 0d688c331..994130973 100644 --- a/ts/textsecure/SendMessage.ts +++ b/ts/textsecure/SendMessage.ts @@ -2027,8 +2027,13 @@ export default class MessageSender { ? Proto.DataMessage.encode(proto.dataMessage).finish() : undefined; + const editMessage = proto.editMessage + ? Proto.EditMessage.encode(proto.editMessage).finish() + : undefined; + return Promise.resolve({ dataMessage, + editMessage, errors: [], failoverIdentifiers: [], successfulIdentifiers: [], diff --git a/ts/textsecure/Types.d.ts b/ts/textsecure/Types.d.ts index a59f00efc..27bf0abf1 100644 --- a/ts/textsecure/Types.d.ts +++ b/ts/textsecure/Types.d.ts @@ -250,8 +250,8 @@ export type CallbackResultType = { failoverIdentifiers?: Array; errors?: Array; unidentifiedDeliveries?: Array; - dataMessage?: Uint8Array; - editMessage?: Uint8Array; + dataMessage: Uint8Array | undefined; + editMessage: Uint8Array | undefined; // If this send is not the final step in a multi-step send, we shouldn't treat its // results we would treat a one-step send. diff --git a/ts/util/sendToGroup.ts b/ts/util/sendToGroup.ts index c23fabcfb..1184e96a4 100644 --- a/ts/util/sendToGroup.ts +++ b/ts/util/sendToGroup.ts @@ -632,6 +632,9 @@ export async function sendToGroupViaSenderKey(options: { dataMessage: contentMessage.dataMessage ? Proto.DataMessage.encode(contentMessage.dataMessage).finish() : undefined, + editMessage: contentMessage.editMessage + ? Proto.EditMessage.encode(contentMessage.editMessage).finish() + : undefined, successfulIdentifiers: senderKeyRecipients, unidentifiedDeliveries: senderKeyRecipients,