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
Down to two test failures
This commit is contained in:
5
.babelrc
5
.babelrc
@ -3,11 +3,6 @@
|
|||||||
"plugins": [
|
"plugins": [
|
||||||
"transform-class-properties",
|
"transform-class-properties",
|
||||||
|
|
||||||
// this transforms async functions into generator functions, which
|
|
||||||
// are then made to use the regenerator module by babel's
|
|
||||||
// transform-regnerator plugin (which is enabled by es2015).
|
|
||||||
"transform-async-to-bluebird",
|
|
||||||
|
|
||||||
// This makes sure that the regenerator runtime is available to
|
// This makes sure that the regenerator runtime is available to
|
||||||
// the transpiled code.
|
// the transpiled code.
|
||||||
"transform-runtime",
|
"transform-runtime",
|
||||||
|
@ -161,7 +161,7 @@ which will be fulfilled in the future.
|
|||||||
The typical usage is something like:
|
The typical usage is something like:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
matrixClient.someMethod(arg1, arg2).done(function(result) {
|
matrixClient.someMethod(arg1, arg2).then(function(result) {
|
||||||
...
|
...
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@ -206,7 +206,7 @@ core functionality of the SDK. These examples assume the SDK is setup like this:
|
|||||||
```javascript
|
```javascript
|
||||||
matrixClient.on("RoomMember.membership", function(event, member) {
|
matrixClient.on("RoomMember.membership", function(event, member) {
|
||||||
if (member.membership === "invite" && member.userId === myUserId) {
|
if (member.membership === "invite" && member.userId === myUserId) {
|
||||||
matrixClient.joinRoom(member.roomId).done(function() {
|
matrixClient.joinRoom(member.roomId).then(function() {
|
||||||
console.log("Auto-joined %s", member.roomId);
|
console.log("Auto-joined %s", member.roomId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -297,7 +297,7 @@ End-to-end encryption support
|
|||||||
=============================
|
=============================
|
||||||
|
|
||||||
The SDK supports end-to-end encryption via the Olm and Megolm protocols, using
|
The SDK supports end-to-end encryption via the Olm and Megolm protocols, using
|
||||||
[libolm](https://gitlab.matrix.org/matrix-org/olm). It is left up to the
|
[libolm](https://gitlab.matrix.org/matrix-org/olm). It is left up to the
|
||||||
application to make libolm available, via the ``Olm`` global.
|
application to make libolm available, via the ``Olm`` global.
|
||||||
|
|
||||||
It is also necessry to call ``matrixClient.initCrypto()`` after creating a new
|
It is also necessry to call ``matrixClient.initCrypto()`` after creating a new
|
||||||
@ -319,7 +319,7 @@ To provide the Olm library in a browser application:
|
|||||||
|
|
||||||
* download the transpiled libolm (from https://packages.matrix.org/npm/olm/).
|
* download the transpiled libolm (from https://packages.matrix.org/npm/olm/).
|
||||||
* load ``olm.js`` as a ``<script>`` *before* ``browser-matrix.js``.
|
* load ``olm.js`` as a ``<script>`` *before* ``browser-matrix.js``.
|
||||||
|
|
||||||
To provide the Olm library in a node.js application:
|
To provide the Olm library in a node.js application:
|
||||||
|
|
||||||
* ``yarn add https://packages.matrix.org/npm/olm/olm-3.1.4.tgz``
|
* ``yarn add https://packages.matrix.org/npm/olm/olm-3.1.4.tgz``
|
||||||
|
@ -56,7 +56,7 @@ rl.on('line', function(line) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (notSentEvent) {
|
if (notSentEvent) {
|
||||||
matrixClient.resendEvent(notSentEvent, viewingRoom).done(function() {
|
matrixClient.resendEvent(notSentEvent, viewingRoom).then(function() {
|
||||||
printMessages();
|
printMessages();
|
||||||
rl.prompt();
|
rl.prompt();
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
@ -70,7 +70,7 @@ rl.on('line', function(line) {
|
|||||||
}
|
}
|
||||||
else if (line.indexOf("/more ") === 0) {
|
else if (line.indexOf("/more ") === 0) {
|
||||||
var amount = parseInt(line.split(" ")[1]) || 20;
|
var amount = parseInt(line.split(" ")[1]) || 20;
|
||||||
matrixClient.scrollback(viewingRoom, amount).done(function(room) {
|
matrixClient.scrollback(viewingRoom, amount).then(function(room) {
|
||||||
printMessages();
|
printMessages();
|
||||||
rl.prompt();
|
rl.prompt();
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
@ -79,7 +79,7 @@ rl.on('line', function(line) {
|
|||||||
}
|
}
|
||||||
else if (line.indexOf("/invite ") === 0) {
|
else if (line.indexOf("/invite ") === 0) {
|
||||||
var userId = line.split(" ")[1].trim();
|
var userId = line.split(" ")[1].trim();
|
||||||
matrixClient.invite(viewingRoom.roomId, userId).done(function() {
|
matrixClient.invite(viewingRoom.roomId, userId).then(function() {
|
||||||
printMessages();
|
printMessages();
|
||||||
rl.prompt();
|
rl.prompt();
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
@ -92,7 +92,7 @@ rl.on('line', function(line) {
|
|||||||
matrixClient.uploadContent({
|
matrixClient.uploadContent({
|
||||||
stream: stream,
|
stream: stream,
|
||||||
name: filename
|
name: filename
|
||||||
}).done(function(url) {
|
}).then(function(url) {
|
||||||
var content = {
|
var content = {
|
||||||
msgtype: "m.file",
|
msgtype: "m.file",
|
||||||
body: filename,
|
body: filename,
|
||||||
@ -116,7 +116,7 @@ rl.on('line', function(line) {
|
|||||||
viewingRoom = roomList[roomIndex];
|
viewingRoom = roomList[roomIndex];
|
||||||
if (viewingRoom.getMember(myUserId).membership === "invite") {
|
if (viewingRoom.getMember(myUserId).membership === "invite") {
|
||||||
// join the room first
|
// join the room first
|
||||||
matrixClient.joinRoom(viewingRoom.roomId).done(function(room) {
|
matrixClient.joinRoom(viewingRoom.roomId).then(function(room) {
|
||||||
setRoomList();
|
setRoomList();
|
||||||
viewingRoom = room;
|
viewingRoom = room;
|
||||||
printMessages();
|
printMessages();
|
||||||
@ -128,7 +128,7 @@ rl.on('line', function(line) {
|
|||||||
else {
|
else {
|
||||||
printMessages();
|
printMessages();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rl.prompt();
|
rl.prompt();
|
||||||
});
|
});
|
||||||
@ -281,8 +281,8 @@ function printMemberList(room) {
|
|||||||
member.membership + new Array(10 - member.membership.length).join(" ")
|
member.membership + new Array(10 - member.membership.length).join(" ")
|
||||||
);
|
);
|
||||||
print(
|
print(
|
||||||
"%s"+fmt(" :: ")+"%s"+fmt(" (")+"%s"+fmt(")"),
|
"%s"+fmt(" :: ")+"%s"+fmt(" (")+"%s"+fmt(")"),
|
||||||
membershipWithPadding, member.name,
|
membershipWithPadding, member.name,
|
||||||
(member.userId === myUserId ? "Me" : member.userId),
|
(member.userId === myUserId ? "Me" : member.userId),
|
||||||
fmt
|
fmt
|
||||||
);
|
);
|
||||||
@ -295,7 +295,7 @@ function printRoomInfo(room) {
|
|||||||
var sendHeader = " Sender ";
|
var sendHeader = " Sender ";
|
||||||
// pad content to 100
|
// pad content to 100
|
||||||
var restCount = (
|
var restCount = (
|
||||||
100 - "Content".length - " | ".length - " | ".length -
|
100 - "Content".length - " | ".length - " | ".length -
|
||||||
eTypeHeader.length - sendHeader.length
|
eTypeHeader.length - sendHeader.length
|
||||||
);
|
);
|
||||||
var padSide = new Array(Math.floor(restCount/2)).join(" ");
|
var padSide = new Array(Math.floor(restCount/2)).join(" ");
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"another-json": "^0.2.0",
|
"another-json": "^0.2.0",
|
||||||
"babel-runtime": "^6.26.0",
|
"babel-runtime": "^6.26.0",
|
||||||
"bluebird": "3.5.5",
|
|
||||||
"browser-request": "^0.3.3",
|
"browser-request": "^0.3.3",
|
||||||
"bs58": "^4.0.1",
|
"bs58": "^4.0.1",
|
||||||
"content-type": "^1.0.2",
|
"content-type": "^1.0.2",
|
||||||
@ -63,7 +62,6 @@
|
|||||||
"babel-cli": "^6.18.0",
|
"babel-cli": "^6.18.0",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
"babel-jest": "^23.6.0",
|
"babel-jest": "^23.6.0",
|
||||||
"babel-plugin-transform-async-to-bluebird": "^1.1.1",
|
|
||||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||||
"babel-plugin-transform-runtime": "^6.23.0",
|
"babel-plugin-transform-runtime": "^6.23.0",
|
||||||
"babel-preset-es2015": "^6.18.0",
|
"babel-preset-es2015": "^6.18.0",
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
import Promise from 'bluebird';
|
|
||||||
|
|
||||||
// load olm before the sdk if possible
|
// load olm before the sdk if possible
|
||||||
import './olm-loader';
|
import './olm-loader';
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
import 'source-map-support/register';
|
import 'source-map-support/register';
|
||||||
import Promise from 'bluebird';
|
|
||||||
const sdk = require("../..");
|
const sdk = require("../..");
|
||||||
const MatrixClient = sdk.MatrixClient;
|
const MatrixClient = sdk.MatrixClient;
|
||||||
|
|
||||||
|
@ -3866,10 +3866,10 @@ MatrixClient.prototype.setRoomMutePushRule = function(scope, roomId, mute) {
|
|||||||
// This is a workaround to SYN-590 (Push rule update fails)
|
// This is a workaround to SYN-590 (Push rule update fails)
|
||||||
deferred = utils.defer();
|
deferred = utils.defer();
|
||||||
this.deletePushRule(scope, "room", roomPushRule.rule_id)
|
this.deletePushRule(scope, "room", roomPushRule.rule_id)
|
||||||
.done(function() {
|
.then(function() {
|
||||||
self.addPushRule(scope, "room", roomId, {
|
self.addPushRule(scope, "room", roomId, {
|
||||||
actions: ["dont_notify"],
|
actions: ["dont_notify"],
|
||||||
}).done(function() {
|
}).then(function() {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
deferred.reject(err);
|
deferred.reject(err);
|
||||||
@ -3885,8 +3885,8 @@ MatrixClient.prototype.setRoomMutePushRule = function(scope, roomId, mute) {
|
|||||||
if (deferred) {
|
if (deferred) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// Update this.pushRules when the operation completes
|
// Update this.pushRules when the operation completes
|
||||||
deferred.done(function() {
|
deferred.then(function() {
|
||||||
self.getPushRules().done(function(result) {
|
self.getPushRules().then(function(result) {
|
||||||
self.pushRules = result;
|
self.pushRules = result;
|
||||||
resolve();
|
resolve();
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
@ -3895,7 +3895,7 @@ MatrixClient.prototype.setRoomMutePushRule = function(scope, roomId, mute) {
|
|||||||
}, function(err) {
|
}, function(err) {
|
||||||
// Update it even if the previous operation fails. This can help the
|
// Update it even if the previous operation fails. This can help the
|
||||||
// app to recover when push settings has been modifed from another client
|
// app to recover when push settings has been modifed from another client
|
||||||
self.getPushRules().done(function(result) {
|
self.getPushRules().then(function(result) {
|
||||||
self.pushRules = result;
|
self.pushRules = result;
|
||||||
reject(err);
|
reject(err);
|
||||||
}, function(err2) {
|
}, function(err2) {
|
||||||
@ -4389,7 +4389,7 @@ MatrixClient.prototype.startClient = async function(opts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this._crypto) {
|
if (this._crypto) {
|
||||||
this._crypto.uploadDeviceKeys().done();
|
this._crypto.uploadDeviceKeys();
|
||||||
this._crypto.start();
|
this._crypto.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5348,5 +5348,4 @@ module.exports.CRYPTO_ENABLED = CRYPTO_ENABLED;
|
|||||||
* @property {Function} then promise.then(onFulfilled, onRejected, onProgress)
|
* @property {Function} then promise.then(onFulfilled, onRejected, onProgress)
|
||||||
* @property {Function} catch promise.catch(onRejected)
|
* @property {Function} catch promise.catch(onRejected)
|
||||||
* @property {Function} finally promise.finally(callback)
|
* @property {Function} finally promise.finally(callback)
|
||||||
* @property {Function} done promise.done(onFulfilled, onRejected, onProgress)
|
|
||||||
*/
|
*/
|
||||||
|
@ -22,7 +22,6 @@ limitations under the License.
|
|||||||
* @module crypto/algorithms/megolm
|
* @module crypto/algorithms/megolm
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Promise from 'bluebird';
|
|
||||||
import logger from '../../logger';
|
import logger from '../../logger';
|
||||||
|
|
||||||
const utils = require("../../utils");
|
const utils = require("../../utils");
|
||||||
|
@ -23,7 +23,6 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const anotherjson = require('another-json');
|
const anotherjson = require('another-json');
|
||||||
import Promise from 'bluebird';
|
|
||||||
import {EventEmitter} from 'events';
|
import {EventEmitter} from 'events';
|
||||||
import ReEmitter from '../ReEmitter';
|
import ReEmitter from '../ReEmitter';
|
||||||
|
|
||||||
@ -1123,7 +1122,7 @@ function _maybeUploadOneTimeKeys(crypto) {
|
|||||||
// it will be set again on the next /sync-response
|
// it will be set again on the next /sync-response
|
||||||
crypto._oneTimeKeyCount = undefined;
|
crypto._oneTimeKeyCount = undefined;
|
||||||
crypto._oneTimeKeyCheckInProgress = false;
|
crypto._oneTimeKeyCheckInProgress = false;
|
||||||
}).done();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns a promise which resolves to the response
|
// returns a promise which resolves to the response
|
||||||
@ -2136,7 +2135,7 @@ Crypto.prototype.requestRoomKey = function(requestBody, recipients, resend=false
|
|||||||
logger.error(
|
logger.error(
|
||||||
'Error requesting key for event', e,
|
'Error requesting key for event', e,
|
||||||
);
|
);
|
||||||
}).done();
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2149,7 +2148,7 @@ Crypto.prototype.cancelRoomKeyRequest = function(requestBody) {
|
|||||||
this._outgoingRoomKeyRequestManager.cancelRoomKeyRequest(requestBody)
|
this._outgoingRoomKeyRequestManager.cancelRoomKeyRequest(requestBody)
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
logger.warn("Error clearing pending room key requests", e);
|
logger.warn("Error clearing pending room key requests", e);
|
||||||
}).done();
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Promise from 'bluebird';
|
|
||||||
|
|
||||||
import logger from '../../logger';
|
import logger from '../../logger';
|
||||||
import MemoryCryptoStore from './memory-crypto-store';
|
import MemoryCryptoStore from './memory-crypto-store';
|
||||||
|
|
||||||
|
@ -15,8 +15,6 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Promise from 'bluebird';
|
|
||||||
|
|
||||||
import logger from '../../logger';
|
import logger from '../../logger';
|
||||||
import utils from '../../utils';
|
import utils from '../../utils';
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ limitations under the License.
|
|||||||
* @module models/event
|
* @module models/event
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Promise from 'bluebird';
|
|
||||||
import {EventEmitter} from 'events';
|
import {EventEmitter} from 'events';
|
||||||
import utils from '../utils.js';
|
import utils from '../utils.js';
|
||||||
import logger from '../logger';
|
import logger from '../logger';
|
||||||
|
@ -21,7 +21,6 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const unhomoglyph = require('unhomoglyph');
|
const unhomoglyph = require('unhomoglyph');
|
||||||
import Promise from 'bluebird';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode a dictionary of query parameters.
|
* Encode a dictionary of query parameters.
|
||||||
|
Reference in New Issue
Block a user