Skip to content

Commit 6df1574

Browse files
committed
onLoadCompleted is now onTokenLoginCompleted
1 parent 05c667b commit 6df1574

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎src/vector/index.js‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,16 @@ function getConfig() {
216216
return deferred.promise;
217217
}
218218

219-
function onLoadCompleted() {
219+
function onTokenLoginCompleted() {
220220
// if we did a token login, we're now left with the token, hs and is
221221
// url as query params in the url; a little nasty but let's redirect to
222222
// clear them.
223-
if (window.location.search) {
224-
var parsedUrl = url.parse(window.location.href);
225-
parsedUrl.search = "";
226-
var formatted = url.format(parsedUrl);
227-
console.log("Redirecting to " + formatted + " to drop loginToken " +
228-
"from queryparams");
229-
window.location.href = formatted;
230-
}
223+
var parsedUrl = url.parse(window.location.href);
224+
parsedUrl.search = "";
225+
var formatted = url.format(parsedUrl);
226+
console.log("Redirecting to " + formatted + " to drop loginToken " +
227+
"from queryparams");
228+
window.location.href = formatted;
231229
}
232230

233231
async function loadApp() {
@@ -288,7 +286,7 @@ async function loadApp() {
288286
realQueryParams={params}
289287
startingFragmentQueryParams={fragparts.params}
290288
enableGuest={true}
291-
onLoadCompleted={onLoadCompleted}
289+
onTokenLoginCompleted={onTokenLoginCompleted}
292290
initialScreenAfterLogin={getScreenFromLocation(window.location)}
293291
defaultDeviceDisplayName={PlatformPeg.get().getDefaultDeviceDisplayName()}
294292
/>,

‎test/app-tests/loading.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('loading:', function () {
4747
// the mounted MatrixChat
4848
let matrixChat;
4949

50-
// a promise which resolves when the MatrixChat calls onLoadCompleted
50+
// a promise which resolves when the MatrixChat calls onTokenLoginCompleted
5151
let loadCompletePromise;
5252

5353
beforeEach(function() {
@@ -135,7 +135,7 @@ describe('loading:', function () {
135135
realQueryParams={params}
136136
startingFragmentQueryParams={fragParts.params}
137137
enableGuest={true}
138-
onLoadCompleted={loadCompleteDefer.resolve}
138+
onTokenLoginCompleted={loadCompleteDefer.resolve}
139139
initialScreenAfterLogin={getScreenFromLocation(windowLocation)}
140140
makeRegistrationUrl={() => {throw new Error('Not implemented');}}
141141
/>, parentDiv
@@ -360,6 +360,8 @@ describe('loading:', function () {
360360
loadApp({
361361
uriFragment: "#/login",
362362
});
363+
364+
return q.delay(1);
363365
});
364366

365367
it('shows a login view', function() {
@@ -513,7 +515,7 @@ describe('loading:', function () {
513515

514516
return httpBackend.flush();
515517
}).then(() => {
516-
// at this point, MatrixChat should fire onLoadCompleted, which
518+
// at this point, MatrixChat should fire onTokenLoginCompleted, which
517519
// makes index.js reload the app. We're not going to attempt to
518520
// simulate the reload - just check that things are left in the
519521
// right state for the reloaded app.

0 commit comments

Comments
 (0)