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
* @param {string} credentials.homeserverUrl The base HS URL
* @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
* @param {MatrixClientCreds} credentials The credentials to use
*/
function setLoggedIn(credentials) {
credentials.guest = Boolean(credentials.guest);
@ -80,11 +76,7 @@ function startMatrixClient() {
UserActivity.start();
Presence.start();
// the react sdk doesn't work without this, so don't allow
// 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);
MatrixClientPeg.start();
}
function onLoggedOut() {

View file

@ -17,6 +17,7 @@ limitations under the License.
'use strict';
import Matrix from 'matrix-js-sdk';
import utils from 'matrix-js-sdk/lib/utils';
const localStorage = window.localStorage;
@ -49,10 +50,10 @@ class MatrixClientPeg {
constructor() {
this.matrixClient = null;
// These are the default options used when Lifecycle.js
// starts the client. These can be altered at any
// time up to after the 'will_start_client' event is
// finished processing.
// These are the default options used when when the
// client is started in 'start'. These can be altered
// at any time up to after the 'will_start_client'
// event is finished processing.
this.opts = {
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) {
if (localStorage) {
try {