Merge remote-tracking branch 'origin/develop' into dbkr/deactivate_account

This commit is contained in:
David Baker 2016-08-03 17:52:35 +01:00
commit afa46a855b
2 changed files with 14 additions and 14 deletions

View file

@ -22,11 +22,7 @@ import dis from './dispatcher';
/** /**
* Transitions to a logged-in state using the given credentials * Transitions to a logged-in state using the given credentials
* @param {string} credentials.homeserverUrl The base HS URL * @param {MatrixClientCreds} credentials The credentials to use
* @param {string} credentials.identityServerUrl The base IS URL
* @param {string} credentials.userId The full Matrix User ID
* @param {string} credentials.accessToken The session access token
* @param {boolean} credentials.guest True if the session is a guest session
*/ */
function setLoggedIn(credentials) { function setLoggedIn(credentials) {
credentials.guest = Boolean(credentials.guest); credentials.guest = Boolean(credentials.guest);
@ -80,11 +76,7 @@ function startMatrixClient() {
UserActivity.start(); UserActivity.start();
Presence.start(); Presence.start();
// the react sdk doesn't work without this, so don't allow MatrixClientPeg.start();
// it to be overridden (and modify the global object so at
// at least the app can see we've changed it)
MatrixClientPeg.opts.pendingEventOrdering = "detached";
MatrixClientPeg.get().startClient(MatrixClientPeg.opts);
} }
function onLoggedOut() { function onLoggedOut() {

View file

@ -17,6 +17,7 @@ limitations under the License.
'use strict'; 'use strict';
import Matrix from 'matrix-js-sdk'; import Matrix from 'matrix-js-sdk';
import utils from 'matrix-js-sdk/lib/utils';
const localStorage = window.localStorage; const localStorage = window.localStorage;
@ -49,10 +50,10 @@ class MatrixClientPeg {
constructor() { constructor() {
this.matrixClient = null; this.matrixClient = null;
// These are the default options used when Lifecycle.js // These are the default options used when when the
// starts the client. These can be altered at any // client is started in 'start'. These can be altered
// time up to after the 'will_start_client' event is // at any time up to after the 'will_start_client'
// finished processing. // event is finished processing.
this.opts = { this.opts = {
initialSyncLimit: 20, initialSyncLimit: 20,
}; };
@ -88,6 +89,13 @@ class MatrixClientPeg {
); );
} }
start() {
const opts = utils.deepCopy(this.opts);
// the react sdk doesn't work without this, so don't allow
opts.pendingEventOrdering = "detached";
this.get().startClient(opts);
}
_replaceClient(hs_url, is_url, user_id, access_token, isGuest) { _replaceClient(hs_url, is_url, user_id, access_token, isGuest) {
if (localStorage) { if (localStorage) {
try { try {