You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Handle device change notifications from /sync
When we get a notification from /sync that a user has updated their device list, mark the list outdated, and then fire off a device query.
This commit is contained in:
@@ -1018,20 +1018,35 @@ MatrixBaseApis.prototype.uploadKeysRequest = function(content, opts, callback) {
|
||||
*
|
||||
* @param {string[]} userIds list of users to get keys for
|
||||
*
|
||||
* @param {module:client.callback=} callback
|
||||
* @param {Object=} opts
|
||||
*
|
||||
* @param {string=} opts.token sync token to pass in the query request, to help
|
||||
* the HS give the most recent results
|
||||
*
|
||||
* @return {module:client.Promise} Resolves: result object. Rejects: with
|
||||
* an error response ({@link module:http-api.MatrixError}).
|
||||
*/
|
||||
MatrixBaseApis.prototype.downloadKeysForUsers = function(userIds, callback) {
|
||||
const downloadQuery = {};
|
||||
|
||||
for (let i = 0; i < userIds.length; ++i) {
|
||||
downloadQuery[userIds[i]] = {};
|
||||
MatrixBaseApis.prototype.downloadKeysForUsers = function(userIds, opts) {
|
||||
if (utils.isFunction(opts)) {
|
||||
// opts used to be 'callback'.
|
||||
throw new Error(
|
||||
'downloadKeysForUsers no longer accepts a callback parameter',
|
||||
);
|
||||
}
|
||||
const content = {device_keys: downloadQuery};
|
||||
opts = opts || {};
|
||||
|
||||
const content = {
|
||||
device_keys: {},
|
||||
};
|
||||
if ('token' in opts) {
|
||||
content.token = opts.token;
|
||||
}
|
||||
userIds.forEach((u) => {
|
||||
content.device_keys[u] = {};
|
||||
});
|
||||
|
||||
return this._http.authedRequestWithPrefix(
|
||||
callback, "POST", "/keys/query", undefined, content,
|
||||
undefined, "POST", "/keys/query", undefined, content,
|
||||
httpApi.PREFIX_UNSTABLE,
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user