From a62f6d109431eeddea55043fca06fb4819c9942a Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 21 Jun 2017 14:04:43 +0100 Subject: [PATCH 1/7] Make the indexeddb worker script work again Removed in https://github.com/matrix-org/matrix-react-sdk/commit/939f6d07984cd51241357a5e61bf76bd46179fcf --- src/MatrixClientPeg.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index 47370e2142..ba372add13 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2017 Vector Creations Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -127,7 +128,7 @@ class MatrixClientPeg { timelineSupport: true, }; - this.matrixClient = createMatrixClient(opts); + this.matrixClient = createMatrixClient(opts, this.indexedDbWorkerScript); // we're going to add eventlisteners for each matrix event tile, so the // potential number of event listeners is quite high. From 2db24f373ce0a568047e25fddd4206f18e551528 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 21 Jun 2017 11:27:18 +0100 Subject: [PATCH 2/7] Fix another race with first-sync Set the first sync variables in onWillStartClient, as they race if set on logged in (similar fix to https://github.com/matrix-org/matrix-react-sdk/pull/1124) --- src/components/structures/MatrixChat.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index e5aefdf665..39a8225b8a 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -919,10 +919,6 @@ module.exports = React.createClass({ dis.dispatch({action: 'view_home_page'}); } else if (this._is_registered) { this._is_registered = false; - // reset the 'have completed first sync' flag, - // since we've just logged in and will be about to sync - this.firstSyncComplete = false; - this.firstSyncPromise = q.defer(); // Set the display name = user ID localpart MatrixClientPeg.get().setDisplayName( @@ -992,6 +988,12 @@ module.exports = React.createClass({ // Set ready to false now, then it'll be set to true when the sync // listener we set below fires. this.setState({ready: false}); + + // reset the 'have completed first sync' flag, + // since we're about to start the client and therefore about + // to do the first sync + this.firstSyncComplete = false; + this.firstSyncPromise = q.defer(); const cli = MatrixClientPeg.get(); // Allow the JS SDK to reap timeline events. This reduces the amount of From dcd0103acb8198fddfb3b7262b8c406729ddc137 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 20 Jun 2017 15:46:54 +0100 Subject: [PATCH 3/7] Fix ability to invite users with caps in their user IDs By lowercasing only when testing against local user IDs/display names. The user_directory shouldn't care. And when we make the placeholder "We didn't get any results, but here's the user with the exact mxid you typed in", use the original query. --- src/components/views/dialogs/ChatInviteDialog.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js index 9a14cb91d3..a85efadef7 100644 --- a/src/components/views/dialogs/ChatInviteDialog.js +++ b/src/components/views/dialogs/ChatInviteDialog.js @@ -178,7 +178,7 @@ module.exports = React.createClass({ }, onQueryChanged: function(ev) { - const query = ev.target.value.toLowerCase(); + const query = ev.target.value; if (this.queryChangedDebouncer) { clearTimeout(this.queryChangedDebouncer); } @@ -271,10 +271,11 @@ module.exports = React.createClass({ query, searchError: null, }); + const queryLowercase = query.toLowerCase(); const results = []; MatrixClientPeg.get().getUsers().forEach((user) => { - if (user.userId.toLowerCase().indexOf(query) === -1 && - user.displayName.toLowerCase().indexOf(query) === -1 + if (user.userId.toLowerCase().indexOf(queryLowercase) === -1 && + user.displayName.toLowerCase().indexOf(queryLowercase) === -1 ) { return; } From e9ab667d292dade3233e5bb35b04fc4ee4c5b158 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 21 Jun 2017 17:43:34 +0100 Subject: [PATCH 4/7] Use the web worker when clearing js-sdk stores It turns out that Firefox doesn't let you use indexeddb from private tabs, *unless* you are *also* in a webworker. We need to either consistently use it or not use it - so let's use it. --- src/MatrixClientPeg.js | 3 +-- src/utils/createMatrixClient.js | 10 ++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index ba372add13..774a1e598c 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -48,7 +48,6 @@ class MatrixClientPeg { this.opts = { initialSyncLimit: 20, }; - this.indexedDbWorkerScript = null; } /** @@ -59,7 +58,7 @@ class MatrixClientPeg { * @param {string} script href to the script to be passed to the web worker */ setIndexedDbWorkerScript(script) { - this.indexedDbWorkerScript = script; + createMatrixClient.indexedDbWorkerScript = script; } get(): MatrixClient { diff --git a/src/utils/createMatrixClient.js b/src/utils/createMatrixClient.js index 5effd63f2a..b95a9f111f 100644 --- a/src/utils/createMatrixClient.js +++ b/src/utils/createMatrixClient.js @@ -25,13 +25,13 @@ const localStorage = window.localStorage; * @param {Object} opts options to pass to Matrix.createClient. This will be * extended with `sessionStore` and `store` members. * - * @param {string} indexedDbWorkerScript Optional URL for a web worker script - * for IndexedDB store operations. If not given, indexeddb ops are done on + * @property {string} indexedDbWorkerScript Optional URL for a web worker script + * for IndexedDB store operations. By default, indexeddb ops are done on * the main thread. * * @returns {MatrixClient} the newly-created MatrixClient */ -export default function createMatrixClient(opts, indexedDbWorkerScript) { +export default function createMatrixClient(opts) { const storeOpts = {}; if (localStorage) { @@ -45,7 +45,7 @@ export default function createMatrixClient(opts, indexedDbWorkerScript) { indexedDB: window.indexedDB, dbName: "riot-web-sync", localStorage: localStorage, - workerScript: indexedDbWorkerScript, + workerScript: createMatrixClient.indexedDbWorkerScript, }); } @@ -53,3 +53,5 @@ export default function createMatrixClient(opts, indexedDbWorkerScript) { return Matrix.createClient(opts); } + +createMatrixClient.indexedDbWorkerScript = null; From 6881fdf1025e735411e3a65fb77cb15118531a5c Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 22 Jun 2017 11:52:13 +0100 Subject: [PATCH 5/7] js-sdk 0.7.13 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f49fc04661..5d6aebe52f 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "isomorphic-fetch": "^2.2.1", "linkifyjs": "^2.1.3", "lodash": "^4.13.1", - "matrix-js-sdk": "0.7.12", + "matrix-js-sdk": "0.7.13", "optimist": "^0.6.1", "prop-types": "^15.5.8", "q": "^1.4.1", From 5700c179252b20a5cd4e87f776f69a8818f7258e Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 22 Jun 2017 11:57:27 +0100 Subject: [PATCH 6/7] Prepare changelog for v0.9.7 --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22049b6af6..8bc4bbcfce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +Changes in [0.9.7](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.9.7) (2017-06-22) +=================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.9.6...v0.9.7) + + * Fix ability to invite users with caps in their user IDs + [\#1128](https://github.com/matrix-org/matrix-react-sdk/pull/1128) + * Fix another race with first-sync + [\#1131](https://github.com/matrix-org/matrix-react-sdk/pull/1131) + * Make the indexeddb worker script work again + [\#1132](https://github.com/matrix-org/matrix-react-sdk/pull/1132) + * Use the web worker when clearing js-sdk stores + [\#1133](https://github.com/matrix-org/matrix-react-sdk/pull/1133) + Changes in [0.9.6](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.9.6) (2017-06-20) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.9.5...v0.9.6) From f7aad3c422f83459cf4657ce260d4bf050d30c4b Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 22 Jun 2017 11:57:27 +0100 Subject: [PATCH 7/7] v0.9.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d6aebe52f..cbc06c9771 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "0.9.6", + "version": "0.9.7", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": {