You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-07-30 04:23:07 +03:00
Add a message ID on each to-device message (#2938)
To make it easier to track down where to-device messages are getting lost, add a custom property to each one, and log its value. Synapse will also log this property.
This commit is contained in:
committed by
GitHub
parent
2c8eece5ca
commit
683e7fba4a
@ -1010,18 +1010,24 @@ describe("Crypto", function() {
|
||||
|
||||
it("encrypts and sends to devices", async () => {
|
||||
client.httpBackend
|
||||
.when("PUT", "/sendToDevice/m.room.encrypted", {
|
||||
messages: {
|
||||
"@bob:example.org": {
|
||||
bobweb: encryptedPayload,
|
||||
bobmobile: encryptedPayload,
|
||||
.when("PUT", "/sendToDevice/m.room.encrypted")
|
||||
.check((request) => {
|
||||
const data = request.data;
|
||||
delete data.messages["@bob:example.org"]["bobweb"]["org.matrix.msgid"];
|
||||
delete data.messages["@bob:example.org"]["bobmobile"]["org.matrix.msgid"];
|
||||
delete data.messages["@carol:example.org"]["caroldesktop"]["org.matrix.msgid"];
|
||||
expect(data).toStrictEqual({
|
||||
messages: {
|
||||
"@bob:example.org": {
|
||||
bobweb: encryptedPayload,
|
||||
bobmobile: encryptedPayload,
|
||||
},
|
||||
"@carol:example.org": {
|
||||
caroldesktop: encryptedPayload,
|
||||
},
|
||||
},
|
||||
"@carol:example.org": {
|
||||
caroldesktop: encryptedPayload,
|
||||
},
|
||||
},
|
||||
})
|
||||
.respond(200, {});
|
||||
});
|
||||
}).respond(200, {});
|
||||
|
||||
await Promise.all([
|
||||
client.client.encryptAndSendToDevices(
|
||||
@ -1044,9 +1050,14 @@ describe("Crypto", function() {
|
||||
});
|
||||
|
||||
client.httpBackend
|
||||
.when("PUT", "/sendToDevice/m.room.encrypted", {
|
||||
.when("PUT", "/sendToDevice/m.room.encrypted")
|
||||
.check((req) => {
|
||||
const data = req.data;
|
||||
delete data.messages["@bob:example.org"]["bobweb"]["org.matrix.msgid"];
|
||||
// Carol is nowhere to be seen
|
||||
messages: { "@bob:example.org": { bobweb: encryptedPayload } },
|
||||
expect(data).toStrictEqual({
|
||||
messages: { "@bob:example.org": { bobweb: encryptedPayload } },
|
||||
});
|
||||
})
|
||||
.respond(200, {});
|
||||
|
||||
|
Reference in New Issue
Block a user