fix: don't update profile until user controller initialized, redirect to rooms from SSO login, in create account page redirect to language selection page if no language available (#4274)
This commit is contained in:
parent
b06b1ff16c
commit
0c5a57bc3b
3 changed files with 10 additions and 3 deletions
|
|
@ -131,6 +131,7 @@ class CreatePangeaAccountPageState extends State<CreatePangeaAccountPage> {
|
|||
}
|
||||
|
||||
Future<void> _updateTargetLanguage() async {
|
||||
if (_langCode == null) return;
|
||||
await MatrixState.pangeaController.userController.updateProfile(
|
||||
(profile) {
|
||||
profile.userSettings.targetLanguage = _langCode;
|
||||
|
|
@ -150,7 +151,12 @@ class CreatePangeaAccountPageState extends State<CreatePangeaAccountPage> {
|
|||
|
||||
try {
|
||||
if (_langCode == null) {
|
||||
throw Exception('No language selected');
|
||||
// at this point, there's no cached selected language, and couldn't get
|
||||
// language from cached course code, so go back to the language selection page
|
||||
if (mounted) {
|
||||
context.go('/registration');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final updateFuture = [
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ Future<void> pangeaSSOLoginAction(
|
|||
final route = FluffyChatApp.router.state.fullPath;
|
||||
if (route == null ||
|
||||
(!route.contains("/rooms") && !route.contains('registration'))) {
|
||||
context.go('/registration/create');
|
||||
context.go('/rooms');
|
||||
}
|
||||
},
|
||||
).timeout(const Duration(seconds: 30));
|
||||
|
|
@ -77,7 +77,7 @@ Future<void> pangeaSSOLoginAction(
|
|||
final route = FluffyChatApp.router.state.fullPath;
|
||||
if (route == null ||
|
||||
(!route.contains("/rooms") && !route.contains('registration'))) {
|
||||
context.go('/registration/create');
|
||||
context.go('/rooms');
|
||||
}
|
||||
} else {
|
||||
await redirect;
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ class UserController {
|
|||
Profile Function(Profile) update, {
|
||||
waitForDataInSync = false,
|
||||
}) async {
|
||||
await initialize();
|
||||
final prevTargetLang = _pangeaController.languageController.userL2;
|
||||
final prevBaseLang = _pangeaController.languageController.userL1;
|
||||
final prevHash = profile.hashCode;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue