From 839938bad704b6495b22bba009a28659a25c3367 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 14 Jul 2020 11:39:15 +1000 Subject: [PATCH 1/2] add missing timestamp field for some Outgoing messages --- js/background.js | 5 +++-- js/models/conversations.js | 2 +- libtextsecure/sendmessage.js | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/js/background.js b/js/background.js index 36741687e..48d63175f 100644 --- a/js/background.js +++ b/js/background.js @@ -1391,10 +1391,11 @@ pubKey ); await window.lokiFileServerAPI.updateOurDeviceMapping(); - // TODO: we should ensure the message was sent and retry automatically if not const device = new libsession.Types.PubKey(pubKey); const unlinkMessage = new libsession.Messages.Outgoing.DeviceUnlinkMessage( - pubKey + { + timestamp: Date.now(), + } ); await libsession.getMessageQueue().send(device, unlinkMessage); diff --git a/js/models/conversations.js b/js/models/conversations.js index 6611f9578..6cc5f6a0a 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -1382,7 +1382,7 @@ const groupInvitMessage = new libsession.Messages.Outgoing.GroupInvitationMessage( { identifier: id, - + timestamp: Date.now(), serverName: groupInvitation.name, channelId: groupInvitation.channelId, serverAddress: groupInvitation.address, diff --git a/libtextsecure/sendmessage.js b/libtextsecure/sendmessage.js index 1b45085e2..f09aaa36d 100644 --- a/libtextsecure/sendmessage.js +++ b/libtextsecure/sendmessage.js @@ -458,6 +458,7 @@ MessageSender.prototype = { if (myDevice !== 1 && myDevice !== '1') { const syncReadMessages = new libsession.Messages.Outgoing.SyncReadMessage( { + timestamp: Date.now(), readMessages: reads, } ); From ae1f86325f0881a1f9a2f15039cd1efe3ac9759c Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 14 Jul 2020 11:39:40 +1000 Subject: [PATCH 2/2] lint --- ts/test/session/crypto/MessageEncrypter_test.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ts/test/session/crypto/MessageEncrypter_test.ts b/ts/test/session/crypto/MessageEncrypter_test.ts index 2e1753512..6fcb3119e 100644 --- a/ts/test/session/crypto/MessageEncrypter_test.ts +++ b/ts/test/session/crypto/MessageEncrypter_test.ts @@ -52,10 +52,9 @@ describe('MessageEncrypter', () => { it('should return a MEDIUM_GROUP_CIPHERTEXT envelope type', async () => { const data = crypto.randomBytes(10); - sandbox.stub( - Ratchet, - 'encryptWithSenderKey' - ).resolves({ ciphertext: '' }); + sandbox + .stub(Ratchet, 'encryptWithSenderKey') + .resolves({ ciphertext: '' }); const result = await MessageEncrypter.encrypt( TestUtils.generateFakePubKey(),