You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2026-01-03 23:22:30 +03:00
Remove redundant invalidation of our own device list
89ced198added some code which flagged our own device list as in need of an update. However,8d502743then added code such that we invalidate *all* members of e2e rooms on the first initialsync - which should include ourselves. We can therefore remove the redundant special-case, which mostly serves to simplify the tests.
This commit is contained in:
@@ -52,25 +52,12 @@ export default function TestClient(userId, deviceId, accessToken) {
|
||||
/**
|
||||
* start the client, and wait for it to initialise.
|
||||
*
|
||||
* @param {object?} existingDevices the list of our existing devices to return from
|
||||
* the /query request. Defaults to empty device list
|
||||
* @return {Promise}
|
||||
*/
|
||||
TestClient.prototype.start = function(existingDevices) {
|
||||
TestClient.prototype.start = function() {
|
||||
this.httpBackend.when("GET", "/pushrules").respond(200, {});
|
||||
this.httpBackend.when("POST", "/filter").respond(200, { filter_id: "fid" });
|
||||
this.expectKeyUpload(existingDevices);
|
||||
|
||||
this.httpBackend.when('POST', '/keys/query').respond(200, (path, content) => {
|
||||
expect(Object.keys(content.device_keys)).toEqual([this.userId]);
|
||||
expect(content.device_keys[this.userId]).toEqual({});
|
||||
let res = existingDevices;
|
||||
if (!res) {
|
||||
res = { device_keys: {} };
|
||||
res.device_keys[this.userId] = {};
|
||||
}
|
||||
return res;
|
||||
});
|
||||
this.expectKeyUpload();
|
||||
|
||||
this.client.startClient({
|
||||
// set this so that we can get hold of failed events
|
||||
@@ -111,6 +98,24 @@ TestClient.prototype.expectKeyUpload = function() {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Set up expectations that the client will query device keys.
|
||||
*
|
||||
* We check that the query contains each of the users in `response`.
|
||||
*
|
||||
* @param {Object} response response to the query.
|
||||
*/
|
||||
TestClient.prototype.expectKeyQuery = function(response) {
|
||||
this.httpBackend.when('POST', '/keys/query').respond(
|
||||
200, (path, content) => {
|
||||
Object.keys(response.device_keys).forEach((userId) => {
|
||||
expect(content.device_keys[userId]).toEqual({});
|
||||
});
|
||||
return response;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get the uploaded curve25519 device key
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user