From b29b4a959b8ea7f793e0d6494fb011a340ac7463 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 13 Jul 2017 00:32:07 +0100 Subject: [PATCH] q(...) -> Promise.resolve ``` find src test -name '*.js' | xargs perl -i -pe 's/\b[qQ]\(/Promise.resolve(/' ``` --- src/VectorConferenceHandler.js | 4 ++-- src/components/structures/RoomDirectory.js | 4 ++-- src/vector/platform/ElectronPlatform.js | 4 ++-- src/vector/platform/WebPlatform.js | 2 +- test/app-tests/joining.js | 2 +- test/app-tests/loading.js | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/VectorConferenceHandler.js b/src/VectorConferenceHandler.js index 807fbba0b7..de1aa2332d 100644 --- a/src/VectorConferenceHandler.js +++ b/src/VectorConferenceHandler.js @@ -57,7 +57,7 @@ ConferenceCall.prototype._joinConferenceUser = function() { } var member = groupRoom.getMember(this.confUserId); if (member && member.membership === "join") { - return q(); + return Promise.resolve(); } return this.client.invite(this.groupRoomId, this.confUserId); }; @@ -75,7 +75,7 @@ ConferenceCall.prototype._getConferenceUserRoom = function() { } } if (confRoom) { - return q(confRoom); + return Promise.resolve(confRoom); } return this.client.createRoom({ preset: "private_chat", diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index f487bbd196..ea3aa5a29c 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -117,7 +117,7 @@ module.exports = React.createClass({ }, getMoreRooms: function() { - if (!MatrixClientPeg.get()) return q(); + if (!MatrixClientPeg.get()) return Promise.resolve(); const my_filter_string = this.state.filterString; const my_server = this.state.roomServer; @@ -266,7 +266,7 @@ module.exports = React.createClass({ }, onFillRequest: function(backwards) { - if (backwards || !this.nextBatch) return q(false); + if (backwards || !this.nextBatch) return Promise.resolve(false); return this.getMoreRooms(); }, diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 809abccd19..8e97f23862 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -173,7 +173,7 @@ export default class ElectronPlatform extends VectorBasePlatform { } getAppVersion(): Promise { - return q(remote.app.getVersion()); + return Promise.resolve(remote.app.getVersion()); } startUpdateCheck() { @@ -201,7 +201,7 @@ export default class ElectronPlatform extends VectorBasePlatform { isElectron(): boolean { return true; } requestNotificationPermission(): Promise { - return q('granted'); + return Promise.resolve('granted'); } reload() { diff --git a/src/vector/platform/WebPlatform.js b/src/vector/platform/WebPlatform.js index 5946a57ac8..191876326d 100644 --- a/src/vector/platform/WebPlatform.js +++ b/src/vector/platform/WebPlatform.js @@ -132,7 +132,7 @@ export default class WebPlatform extends VectorBasePlatform { getAppVersion(): Promise { if (this.runningVersion !== null) { - return q(this.runningVersion); + return Promise.resolve(this.runningVersion); } return this._getVersion(); } diff --git a/test/app-tests/joining.js b/test/app-tests/joining.js index 2f7c60707c..6788b5342d 100644 --- a/test/app-tests/joining.js +++ b/test/app-tests/joining.js @@ -106,7 +106,7 @@ describe('joining a room', function () { .respond(200, {}); function awaitSync(attempts) { if (syncDone) { - return q(); + return Promise.resolve(); } if (!attempts) { throw new Error("Gave up waiting for /sync") diff --git a/test/app-tests/loading.js b/test/app-tests/loading.js index d517c05f49..e3291b0b9b 100644 --- a/test/app-tests/loading.js +++ b/test/app-tests/loading.js @@ -683,7 +683,7 @@ function awaitSyncingSpinner(matrixChat, retryLimit, retryCount) { // state looks good, check the rendered output assertAtSyncingSpinner(matrixChat); - return q(); + return Promise.resolve(); } function assertAtSyncingSpinner(matrixChat) { @@ -721,5 +721,5 @@ function awaitRoomView(matrixChat, retryLimit, retryCount) { // state looks good, check the rendered output ReactTestUtils.findRenderedComponentWithType( matrixChat, sdk.getComponent('structures.RoomView')); - return q(); + return Promise.resolve(); }