Direct some flows to the welcome page
This commit is contained in:
parent
7238c713d7
commit
5701bf89de
2 changed files with 17 additions and 9 deletions
|
@ -35,8 +35,10 @@ export const SAFE_LOCALPART_REGEX = /^[a-z0-9=_\-./]+$/;
|
||||||
* on what the HS supports
|
* on what the HS supports
|
||||||
*
|
*
|
||||||
* @param {object} options
|
* @param {object} options
|
||||||
* @param {bool} options.go_home_on_cancel If true, goes to
|
* @param {bool} options.go_home_on_cancel
|
||||||
* the hame page if the user cancels the action
|
* If true, goes to the home page if the user cancels the action
|
||||||
|
* @param {bool} options.go_welcome_on_cancel
|
||||||
|
* If true, goes to the welcome page if the user cancels the action
|
||||||
*/
|
*/
|
||||||
export async function startAnyRegistrationFlow(options) {
|
export async function startAnyRegistrationFlow(options) {
|
||||||
if (options === undefined) options = {};
|
if (options === undefined) options = {};
|
||||||
|
@ -73,6 +75,8 @@ export async function startAnyRegistrationFlow(options) {
|
||||||
dis.dispatch({action: 'start_registration'});
|
dis.dispatch({action: 'start_registration'});
|
||||||
} else if (options.go_home_on_cancel) {
|
} else if (options.go_home_on_cancel) {
|
||||||
dis.dispatch({action: 'view_home_page'});
|
dis.dispatch({action: 'view_home_page'});
|
||||||
|
} else if (options.go_welcome_on_cancel) {
|
||||||
|
dis.dispatch({action: 'view_welcome_page'});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -357,8 +357,8 @@ export default React.createClass({
|
||||||
});
|
});
|
||||||
}).then((loadedSession) => {
|
}).then((loadedSession) => {
|
||||||
if (!loadedSession) {
|
if (!loadedSession) {
|
||||||
// fall back to showing the login screen
|
// fall back to showing the welcome screen
|
||||||
dis.dispatch({action: "start_login"});
|
dis.dispatch({action: "view_welcome_page"});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Note we don't catch errors from this: we catch everything within
|
// Note we don't catch errors from this: we catch everything within
|
||||||
|
@ -967,11 +967,11 @@ export default React.createClass({
|
||||||
}
|
}
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'require_registration',
|
action: 'require_registration',
|
||||||
// If the set_mxid dialog is cancelled, view /home because if the browser
|
// If the set_mxid dialog is cancelled, view /welcome because if the
|
||||||
// was pointing at /user/@someone:domain?action=chat, the URL needs to be
|
// browser was pointing at /user/@someone:domain?action=chat, the URL
|
||||||
// reset so that they can revisit /user/.. // (and trigger
|
// needs to be reset so that they can revisit /user/.. // (and trigger
|
||||||
// `_chatCreateOrReuse` again)
|
// `_chatCreateOrReuse` again)
|
||||||
go_home_on_cancel: true,
|
go_welcome_on_cancel: true,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1192,9 +1192,13 @@ export default React.createClass({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: localStorage.getItem('mx_last_room_id'),
|
room_id: localStorage.getItem('mx_last_room_id'),
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
if (MatrixClientPeg.get().isGuest) {
|
||||||
|
dis.dispatch({action: 'view_welcome_page'});
|
||||||
} else {
|
} else {
|
||||||
dis.dispatch({action: 'view_home_page'});
|
dis.dispatch({action: 'view_home_page'});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue