1
0
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:
Michael Telatynski
2019-12-04 19:17:58 +00:00
parent 8a8109272a
commit 4a47867e49
13 changed files with 22 additions and 41 deletions

View File

@ -3,11 +3,6 @@
"plugins": [
"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
// the transpiled code.
"transform-runtime",

View File

@ -161,7 +161,7 @@ which will be fulfilled in the future.
The typical usage is something like:
```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
matrixClient.on("RoomMember.membership", function(event, member) {
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);
});
}

View File

@ -56,7 +56,7 @@ rl.on('line', function(line) {
}
}
if (notSentEvent) {
matrixClient.resendEvent(notSentEvent, viewingRoom).done(function() {
matrixClient.resendEvent(notSentEvent, viewingRoom).then(function() {
printMessages();
rl.prompt();
}, function(err) {
@ -70,7 +70,7 @@ rl.on('line', function(line) {
}
else if (line.indexOf("/more ") === 0) {
var amount = parseInt(line.split(" ")[1]) || 20;
matrixClient.scrollback(viewingRoom, amount).done(function(room) {
matrixClient.scrollback(viewingRoom, amount).then(function(room) {
printMessages();
rl.prompt();
}, function(err) {
@ -79,7 +79,7 @@ rl.on('line', function(line) {
}
else if (line.indexOf("/invite ") === 0) {
var userId = line.split(" ")[1].trim();
matrixClient.invite(viewingRoom.roomId, userId).done(function() {
matrixClient.invite(viewingRoom.roomId, userId).then(function() {
printMessages();
rl.prompt();
}, function(err) {
@ -92,7 +92,7 @@ rl.on('line', function(line) {
matrixClient.uploadContent({
stream: stream,
name: filename
}).done(function(url) {
}).then(function(url) {
var content = {
msgtype: "m.file",
body: filename,
@ -116,7 +116,7 @@ rl.on('line', function(line) {
viewingRoom = roomList[roomIndex];
if (viewingRoom.getMember(myUserId).membership === "invite") {
// join the room first
matrixClient.joinRoom(viewingRoom.roomId).done(function(room) {
matrixClient.joinRoom(viewingRoom.roomId).then(function(room) {
setRoomList();
viewingRoom = room;
printMessages();

View File

@ -50,7 +50,6 @@
"dependencies": {
"another-json": "^0.2.0",
"babel-runtime": "^6.26.0",
"bluebird": "3.5.5",
"browser-request": "^0.3.3",
"bs58": "^4.0.1",
"content-type": "^1.0.2",
@ -63,7 +62,6 @@
"babel-cli": "^6.18.0",
"babel-eslint": "^10.0.1",
"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-runtime": "^6.23.0",
"babel-preset-es2015": "^6.18.0",

View File

@ -1,6 +1,4 @@
"use strict";
import Promise from 'bluebird';
// load olm before the sdk if possible
import './olm-loader';

View File

@ -1,6 +1,5 @@
"use strict";
import 'source-map-support/register';
import Promise from 'bluebird';
const sdk = require("../..");
const MatrixClient = sdk.MatrixClient;

View File

@ -3866,10 +3866,10 @@ MatrixClient.prototype.setRoomMutePushRule = function(scope, roomId, mute) {
// This is a workaround to SYN-590 (Push rule update fails)
deferred = utils.defer();
this.deletePushRule(scope, "room", roomPushRule.rule_id)
.done(function() {
.then(function() {
self.addPushRule(scope, "room", roomId, {
actions: ["dont_notify"],
}).done(function() {
}).then(function() {
deferred.resolve();
}, function(err) {
deferred.reject(err);
@ -3885,8 +3885,8 @@ MatrixClient.prototype.setRoomMutePushRule = function(scope, roomId, mute) {
if (deferred) {
return new Promise((resolve, reject) => {
// Update this.pushRules when the operation completes
deferred.done(function() {
self.getPushRules().done(function(result) {
deferred.then(function() {
self.getPushRules().then(function(result) {
self.pushRules = result;
resolve();
}, function(err) {
@ -3895,7 +3895,7 @@ MatrixClient.prototype.setRoomMutePushRule = function(scope, roomId, mute) {
}, function(err) {
// Update it even if the previous operation fails. This can help the
// 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;
reject(err);
}, function(err2) {
@ -4389,7 +4389,7 @@ MatrixClient.prototype.startClient = async function(opts) {
}
if (this._crypto) {
this._crypto.uploadDeviceKeys().done();
this._crypto.uploadDeviceKeys();
this._crypto.start();
}
@ -5348,5 +5348,4 @@ module.exports.CRYPTO_ENABLED = CRYPTO_ENABLED;
* @property {Function} then promise.then(onFulfilled, onRejected, onProgress)
* @property {Function} catch promise.catch(onRejected)
* @property {Function} finally promise.finally(callback)
* @property {Function} done promise.done(onFulfilled, onRejected, onProgress)
*/

View File

@ -22,7 +22,6 @@ limitations under the License.
* @module crypto/algorithms/megolm
*/
import Promise from 'bluebird';
import logger from '../../logger';
const utils = require("../../utils");

View File

@ -23,7 +23,6 @@ limitations under the License.
*/
const anotherjson = require('another-json');
import Promise from 'bluebird';
import {EventEmitter} from 'events';
import ReEmitter from '../ReEmitter';
@ -1123,7 +1122,7 @@ function _maybeUploadOneTimeKeys(crypto) {
// it will be set again on the next /sync-response
crypto._oneTimeKeyCount = undefined;
crypto._oneTimeKeyCheckInProgress = false;
}).done();
});
}
// returns a promise which resolves to the response
@ -2136,7 +2135,7 @@ Crypto.prototype.requestRoomKey = function(requestBody, recipients, resend=false
logger.error(
'Error requesting key for event', e,
);
}).done();
});
};
/**
@ -2149,7 +2148,7 @@ Crypto.prototype.cancelRoomKeyRequest = function(requestBody) {
this._outgoingRoomKeyRequestManager.cancelRoomKeyRequest(requestBody)
.catch((e) => {
logger.warn("Error clearing pending room key requests", e);
}).done();
});
};
/**

View File

@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import Promise from 'bluebird';
import logger from '../../logger';
import MemoryCryptoStore from './memory-crypto-store';

View File

@ -15,8 +15,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import Promise from 'bluebird';
import logger from '../../logger';
import utils from '../../utils';

View File

@ -21,7 +21,6 @@ limitations under the License.
* @module models/event
*/
import Promise from 'bluebird';
import {EventEmitter} from 'events';
import utils from '../utils.js';
import logger from '../logger';

View File

@ -21,7 +21,6 @@ limitations under the License.
*/
const unhomoglyph = require('unhomoglyph');
import Promise from 'bluebird';
/**
* Encode a dictionary of query parameters.