diff --git a/src/vector/index.js b/src/vector/index.js index 9f1620516..da03327da 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -216,18 +216,16 @@ function getConfig() { return deferred.promise; } -function onLoadCompleted() { +function onTokenLoginCompleted() { // if we did a token login, we're now left with the token, hs and is // url as query params in the url; a little nasty but let's redirect to // clear them. - if (window.location.search) { - var parsedUrl = url.parse(window.location.href); - parsedUrl.search = ""; - var formatted = url.format(parsedUrl); - console.log("Redirecting to " + formatted + " to drop loginToken " + - "from queryparams"); - window.location.href = formatted; - } + var parsedUrl = url.parse(window.location.href); + parsedUrl.search = ""; + var formatted = url.format(parsedUrl); + console.log("Redirecting to " + formatted + " to drop loginToken " + + "from queryparams"); + window.location.href = formatted; } async function loadApp() { @@ -288,7 +286,7 @@ async function loadApp() { realQueryParams={params} startingFragmentQueryParams={fragparts.params} enableGuest={true} - onLoadCompleted={onLoadCompleted} + onTokenLoginCompleted={onTokenLoginCompleted} initialScreenAfterLogin={getScreenFromLocation(window.location)} defaultDeviceDisplayName={PlatformPeg.get().getDefaultDeviceDisplayName()} />, diff --git a/test/app-tests/loading.js b/test/app-tests/loading.js index e660c91e9..17e487a0f 100644 --- a/test/app-tests/loading.js +++ b/test/app-tests/loading.js @@ -48,8 +48,8 @@ describe('loading:', function () { // the mounted MatrixChat let matrixChat; - // a promise which resolves when the MatrixChat calls onLoadCompleted - let loadCompletePromise; + // a promise which resolves when the MatrixChat calls onTokenLoginCompleted + let tokenLoginCompletePromise; beforeEach(function() { test_utils.beforeEach(this); @@ -100,8 +100,8 @@ describe('loading:', function () { toString: function() { return this.search + this.hash; }, }; - let loadCompleteDefer = q.defer(); - loadCompletePromise = loadCompleteDefer.promise; + let tokenLoginCompleteDefer = q.defer(); + tokenLoginCompletePromise = tokenLoginCompleteDefer.promise; function onNewScreen(screen) { console.log(Date.now() + " newscreen "+screen); @@ -136,7 +136,7 @@ describe('loading:', function () { realQueryParams={params} startingFragmentQueryParams={fragParts.params} enableGuest={true} - onLoadCompleted={loadCompleteDefer.resolve} + onTokenLoginCompleted={tokenLoginCompleteDefer.resolve} initialScreenAfterLogin={getScreenFromLocation(windowLocation)} makeRegistrationUrl={() => {throw new Error('Not implemented');}} />, parentDiv @@ -517,12 +517,12 @@ describe('loading:', function () { return httpBackend.flush(); }).then(() => { - // at this point, MatrixChat should fire onLoadCompleted, which + // at this point, MatrixChat should fire onTokenLoginCompleted, which // makes index.js reload the app. We're not going to attempt to // simulate the reload - just check that things are left in the // right state for the reloaded app. - return loadCompletePromise; + return tokenLoginCompletePromise; }).then(() => { // check that the localstorage has been set up in such a way that // the reloaded app can pick up where we leave off.