redirect to user language after profile update (#421)

This commit is contained in:
Kevin Papst
2018-11-15 12:06:57 +01:00
committed by GitHub
parent 07cceca67e
commit a073064900
2 changed files with 10 additions and 2 deletions

View File

@@ -194,7 +194,13 @@ class ProfileController extends AbstractController
$this->flashSuccess('action.update.success');
return $this->redirectToRoute('user_profile_preferences', ['username' => $profile->getUsername()]);
// switch locale if neccessary
$locale = $profile->getPreferenceValue('language', $request->getLocale());
return $this->redirectToRoute('user_profile_preferences', [
'_locale' => $locale,
'username' => $profile->getUsername()
]);
}
return $this->getProfileView($profile, 'preferences', null, null, null, $form);

View File

@@ -242,7 +242,9 @@ class ProfileControllerTest extends ControllerBaseTest
]
]);
$this->assertIsRedirect($client, $this->createUrl('/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/prefs'));
$targetUrl = '/ar/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/prefs';
$this->assertIsRedirect($client, $targetUrl);
$client->followRedirect();
$this->assertTrue($client->getResponse()->isSuccessful());